Had I checked the archives first I would have been able to answer my own
question. For those interested this is how to reference a nested property in
javascript:

document.form['property.nestedProperty'].someFunction();

I did notice that the html:form tag does not handle this situation properly,
so you can't use the focus attribute of this tag to give focus to a nested
property. This is the code it generates, which is incorrect because it adds
a "." after the reference to the form:

document.memberLogin.['credentials.loginPassword'].focus()

-----Original Message-----
From: TJM Todd McGregor [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 18, 2001 3:26 PM
To: '[EMAIL PROTECTED]'
Subject: Referencing nested properties with javascript


Im sure there is a really simple solution to this, I just haven't found it
yet.

I have a property in my ActionForm which is of type Member (Member is a
simple Java object which encapsulates data such as first name, last name,
etc.). In my html page I have an html:text tag with the property value set
to member.firstName. The value from the form is populated just fine, but
when trying to reference the form field in javascript to give focus to the
field I get an error because it is interpreting "member" as an object (i.e.
- document.memberForm.member.firstName.focus()). I tried to escape the "."
between member and firstName but that didn't work. Any Ideas???

Reply via email to