You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeremiah Armstrong <je...@yahoo.com> on 2002/06/24 22:35:11 UTC
Javascript conflict with nested form bean properties using square brackets []
I am having a hard time writing some Javascript
validation in a form whose field names have brackets
because Javascript is confused and thinks that it
should be accessing array elements inside its Document
Object Model instead of simply looking for the name of
a field in my form that contains brackets.
For instance, I want to set the value of an html input
field named "eqptApp[0].downloadPhone" in Javascript:
document.myformname.eqptApp[0].downloadPhone.value =
"123-456-7890";
Of course, I get a scripting error from the browser
complaining that it can't find that element. I've
tried using escape characters ("\") and the eval()
method to overcome this, but to no avail.
Does anyone have suggestions on how to get around
this, either on the scripting side or the client side?
Help is much appreciated!
-- J. Armstrong
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Javascript conflict with nested form bean properties using square brackets []
Posted by James Mitchell <jm...@telocity.com>.
Use different format for form elements...
document.forms["formname"].element["document.myformname.eqptApp[0].downloadP
hone.value"].value
James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://struts-atlanta.open-tools.org
> -----Original Message-----
> From: Jeremiah Armstrong [mailto:jeremiaharmstrong@yahoo.com]
> Sent: Monday, June 24, 2002 4:35 PM
> To: struts-user@jakarta.apache.org
> Subject: Javascript conflict with nested form bean properties using
> square brackets []
>
>
> I am having a hard time writing some Javascript
> validation in a form whose field names have brackets
> because Javascript is confused and thinks that it
> should be accessing array elements inside its Document
> Object Model instead of simply looking for the name of
> a field in my form that contains brackets.
>
> For instance, I want to set the value of an html input
> field named "eqptApp[0].downloadPhone" in Javascript:
>
> document.myformname.eqptApp[0].downloadPhone.value =
> "123-456-7890";
>
> Of course, I get a scripting error from the browser
> complaining that it can't find that element. I've
> tried using escape characters ("\") and the eval()
> method to overcome this, but to no avail.
>
> Does anyone have suggestions on how to get around
> this, either on the scripting side or the client side?
> Help is much appreciated!
>
> -- J. Armstrong
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>