Can someone please let me know, how to set the name of an input checkbox control dynamically?
Part of the name, will include the product code procured via EL from the session scope attribute.
Let us assume the product code is "8601".
Now I want to have a checkbox with the name 8601_check and want to set this dynamically in my jsp page.
How do I do the above?
Right now, all I have is the following:
I get an error message saying, "Invalid location of text(+") in tag(<input>).
8601_check is invalid as it starts with a number rather than a letter or underscore character.
I would suggest "check_8601" instead just to avoid the problems :-)
Bear Bibeault wrote:Actually, id values that start with numerics are completely valid. Whether they are a good idea or not is another matter...
I guess I'm out of date.
Reference to the HTML 4 spec
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
It got changed in the HTML5 spec to be more permissive