You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christina Siena <cs...@mountaincable.net> on 2004/08/13 20:22:49 UTC

Javascript question re: dynamically generated input type='text' controls

Hi,

I am developing a page containing dynamically generated input
type="text" controls where their names consist of multiple composite
keys. The name of the input type="text" controls, however, can not be
referenced correctly using javascript. For example, I have the
following html input tag:

<input type="text" size="1"
name="value(number=1480;countryCode=USA;templateNumber=79999;typeCode=STAGE;languageCode=EN;idTypeCode=MODE:::::)"
value="" disabled="true" class="disabledText"
onchange="benefitsChanged();" />

The following javascript won't work because the control name contains =
and ; and : as follows:

document.formname.number=1480;countryCode=USA;templateNumber=79999;typeCode=STAGE;languageCode=EN;idTypeCode=MODE:::::.value
= "";

I only have one other idea how to solve this problem. Instead of control
names containing the multiple composite keys, instead use a simple valid
name. In the action, map the valid name to the multiple composite keys.
Does
anyone have any other ideas how to solve this?

Thanks in advance.




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Javascript question re: dynamically generated input type='text' controls

Posted by Christina Siena <cs...@mountaincable.net>.
Problem solved. It is possible after all to use input control names
containing equals or semicolon or any delimiter as follows:

document.formname.elements("value(number=1480;countryCode=USA;templateNumber=79999;typeCode=STAGE;languageCode=EN;idTypeCode=MODE:::::)").value
= "";

just in case anyone needs this solution.



> Hi,
>
> I am developing a page containing dynamically generated input
> type="text" controls where their names consist of multiple composite
> keys. The name of the input type="text" controls, however, can not be
> referenced correctly using javascript. For example, I have the
> following html input tag:
>
> <input type="text" size="1"
> name="value(number=1480;countryCode=USA;templateNumber=79999;typeCode=STAGE;languageCode=EN;idTypeCode=MODE:::::)"
> value="" disabled="true" class="disabledText"
> onchange="benefitsChanged();" />
>
> The following javascript won't work because the control name contains =
> and ; and : as follows:
>
> document.formname.number=1480;countryCode=USA;templateNumber=79999;typeCode=STAGE;languageCode=EN;idTypeCode=MODE:::::.value
> = "";
>
> I only have one other idea how to solve this problem. Instead of control
> names containing the multiple composite keys, instead use a simple valid
> name. In the action, map the valid name to the multiple composite keys.
> Does
> anyone have any other ideas how to solve this?
>
> Thanks in advance.
>
>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org