RE: Struts and Javascript question

2001-11-13 Thread Nocera, Robert


Thanks all, that did it.
I wasn't familiar with the document.formname.elements['fieldname'] notation.

-Rob

-Original Message-
From: Jon Wall [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 4:56 PM
To: Struts Users Mailing List
Subject: Re: Struts and Javascript question


Hi Rob - 

Haven't tried tried this with dots, but I had this
problem a long time ago with spaces.  Here's the three
ways (that I know of) to access a form element in
JavaScript:

document.formname.fieldname
document.formname.elements[fieldnum]
document.formname.elements['fieldname']

Using the field number is probably way too brittle for
your purposes, so I'd stick with:

document.formname.elements['data.fieldname']


FYI - you can do this with any javascript object. Chew
on that for a bit, when I did I had a javascript
object model epiphany.  

Hope this helps,
-jon


--- "Nocera, Robert" <[EMAIL PROTECTED]>
wrote:
> Hello all,
> 
> I was wondering if anyone knows how to access a form
> element in javascript
> that has a "." in the name of it.
> 
> For example, if I have a data bean included in a
> form beanm, I can access
> fields in the data bean through tags using the "."
> notation as:
> 
> This create an input text box with the name
> "data.fieldname".
> How can I access that object in Javascript?
> 
> var mydataobj = document.formname.data.fieldname;
> 
> doesn't work because the dot seems to be throwing
> off the parser (at least
> in IE 5.0).
> 
> Any ideas besides creating an accessor in the form
> bean itself?
> 
> Thanks,
> Rob
> 
> 
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is
> confidential and may be privileged. It is intended
> for the addressee(s) only. Access to this E-mail by
> anyone else is unauthorized. If you are not an
> addressee, any disclosure or copying of the contents
> of this E-mail or any action taken (or not taken) in
> reliance on it is unauthorized and may be unlawful.
> If you are not an addressee, please inform the
> sender immediately.
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Struts and Javascript question

2001-11-13 Thread Nekkalapudi, Viplava

You can try passing field using "this".
And get the object name mapped to this.
Something like this:

function getObject(myField) {
// myField is your dataObject
} 

And in form use this as the parameter to JavaScript.


-- Viplava

-Original Message-
From: Nocera, Robert [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 3:47 PM
To: Struts Users Mailing List (E-mail)
Subject: Struts and Javascript question


Hello all,

I was wondering if anyone knows how to access a form element in javascript
that has a "." in the name of it.

For example, if I have a data bean included in a form beanm, I can access
fields in the data bean through tags using the "." notation as:

This create an input text box with the name "data.fieldname".
How can I access that object in Javascript?

var mydataobj = document.formname.data.fieldname;

doesn't work because the dot seems to be throwing off the parser (at least
in IE 5.0).

Any ideas besides creating an accessor in the form bean itself?

Thanks,
Rob


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be
privileged. It is intended for the addressee(s) only. Access to this E-mail
by anyone else is unauthorized. If you are not an addressee, any disclosure
or copying of the contents of this E-mail or any action taken (or not taken)
in reliance on it is unauthorized and may be unlawful. If you are not an
addressee, please inform the sender immediately.

--
To unsubscribe, e-mail:

For additional commands, e-mail:


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Struts and Javascript question

2001-11-13 Thread Jon Wall

Hi Rob - 

Haven't tried tried this with dots, but I had this
problem a long time ago with spaces.  Here's the three
ways (that I know of) to access a form element in
JavaScript:

document.formname.fieldname
document.formname.elements[fieldnum]
document.formname.elements['fieldname']

Using the field number is probably way too brittle for
your purposes, so I'd stick with:

document.formname.elements['data.fieldname']


FYI - you can do this with any javascript object. Chew
on that for a bit, when I did I had a javascript
object model epiphany.  

Hope this helps,
-jon


--- "Nocera, Robert" <[EMAIL PROTECTED]>
wrote:
> Hello all,
> 
> I was wondering if anyone knows how to access a form
> element in javascript
> that has a "." in the name of it.
> 
> For example, if I have a data bean included in a
> form beanm, I can access
> fields in the data bean through tags using the "."
> notation as:
> 
> This create an input text box with the name
> "data.fieldname".
> How can I access that object in Javascript?
> 
> var mydataobj = document.formname.data.fieldname;
> 
> doesn't work because the dot seems to be throwing
> off the parser (at least
> in IE 5.0).
> 
> Any ideas besides creating an accessor in the form
> bean itself?
> 
> Thanks,
> Rob
> 
> 
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is
> confidential and may be privileged. It is intended
> for the addressee(s) only. Access to this E-mail by
> anyone else is unauthorized. If you are not an
> addressee, any disclosure or copying of the contents
> of this E-mail or any action taken (or not taken) in
> reliance on it is unauthorized and may be unlawful.
> If you are not an addressee, please inform the
> sender immediately.
> 
> --
> To unsubscribe, e-mail:  
> 
> For additional commands, e-mail:
> 
> 


__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Struts and Javascript question

2001-11-13 Thread Anil Kumar Kona

May be u can try something like this

var doneForm = document.getElementById('doneForm');

doneForm.elements['data.fieldName'].value

-Anil


-Original Message-
From: Nocera, Robert [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 1:47 PM
To: Struts Users Mailing List (E-mail)
Subject: Struts and Javascript question


Hello all,

I was wondering if anyone knows how to access a form element in javascript
that has a "." in the name of it.

For example, if I have a data bean included in a form beanm, I can access
fields in the data bean through tags using the "." notation as:

This create an input text box with the name "data.fieldname".
How can I access that object in Javascript?

var mydataobj = document.formname.data.fieldname;

doesn't work because the dot seems to be throwing off the parser (at least
in IE 5.0).

Any ideas besides creating an accessor in the form bean itself?

Thanks,
Rob


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be
privileged. It is intended for the addressee(s) only. Access to this E-mail
by anyone else is unauthorized. If you are not an addressee, any disclosure
or copying of the contents of this E-mail or any action taken (or not taken)
in reliance on it is unauthorized and may be unlawful. If you are not an
addressee, please inform the sender immediately.

--
To unsubscribe, e-mail:

For additional commands, e-mail:



--
To unsubscribe, e-mail:   
For additional commands, e-mail: