You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laine Donlan <ld...@elogex.com> on 2001/02/18 23:33:53 UTC

Indexed bean property names and Javascript

I was wondering if anyone has had experience using javascript with form
elements containing nested properties.  Basically I am trying to avoid
looping through the forms elements and matching names to find the
element I want.  However I am having a problem with javascript not
liking form elements names with "."'s in them.

i.e. 
A form generated by the text tag like the following: 
	<input type="text" name="someBean.someProperty">

cannot be accessed by javascript using the
form.someBean.someProperty.value.  

Has anyone had success doing anything like this, or am I missing
something all together?  Thanks in advance.

Laine
 

Re: Indexed bean property names and Javascript

Posted by Jim Richards <gr...@cyber4.org>.
One thing to try in your code is to reference the element as:

	form['someBean.somProperty'].value


Laine Donlan wrote:
> I was wondering if anyone has had experience using javascript with form
> elements containing nested properties.  Basically I am trying to avoid
> looping through the forms elements and matching names to find the
> element I want.  However I am having a problem with javascript not
> liking form elements names with "."'s in them.
> 
> i.e.
> A form generated by the text tag like the following:
>         <input type="text" name="someBean.someProperty">
> 
> cannot be accessed by javascript using the
> form.someBean.someProperty.value.
> 
> Has anyone had success doing anything like this, or am I missing
> something all together?  Thanks in advance.