Connecting Tech Pros Worldwide Forums | Help | Site Map

FAQ Topic - My element is named myselect[] , how do I access it?

FAQ server
Guest
 
Posts: n/a
#1: Mar 3 '07
-----------------------------------------------------------------------
FAQ Topic - My element is named myselect[] , how do I
access it?
-----------------------------------------------------------------------

Form controls with any "illegal" characters can be accessed with
` formref.elements["myselect[]"] ` - The bracket characters,
amongst others, are illegal in ID attributes and JavaScript
identifiers, so you should try to avoid them as browsers may
handle them incorrectly.

http://msdn.microsoft.com/workshop/a...s/elements.asp

http://docs.sun.com/source/816-6408-10/form.htm

http://www.jibbering.com/faq/faq_not....html#FAQN4_25


===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.


OmegaJunior
Guest
 
Posts: n/a
#2: Mar 3 '07

re: FAQ Topic - My element is named myselect[] , how do I access it?


On Sat, 03 Mar 2007 01:00:01 +0100, FAQ server <javascript@dotinternet.be>
wrote:
Quote:
-----------------------------------------------------------------------
FAQ Topic - My element is named myselect[] , how do I
access it?
-----------------------------------------------------------------------
>
Form controls with any "illegal" characters can be accessed with
` formref.elements["myselect[]"] ` - The bracket characters,
amongst others, are illegal in ID attributes and JavaScript
identifiers, so you should try to avoid them as browsers may
handle them incorrectly.
>
http://msdn.microsoft.com/workshop/a...s/elements.asp
>
http://docs.sun.com/source/816-6408-10/form.htm
>
http://www.jibbering.com/faq/faq_not....html#FAQN4_25
>
>
Quote:
(...) The bracket characters,
amongst others, are illegal in ID attributes and JavaScript
identifiers, (...)
Correct according to:
'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 (".").'
http://www.w3.org/TR/html401/types.html#type-cdata

Maybe that should change? Maybe the browsers should grow up?
http://www.whatwg.org/specs/web-form...ngFormControls


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Richard Cornford
Guest
 
Posts: n/a
#3: Mar 3 '07

re: FAQ Topic - My element is named myselect[] , how do I access it?


OmegaJunior wrote:
Quote:
On Sat, 03 Mar 2007 01:00:01 +0100, FAQ server wrote:
<snip>
Quote:
Quote:
>(...) The bracket characters,
>amongst others, are illegal in ID attributes and JavaScript
>identifiers, (...)
>
Correct according to:
Is that supposed to be an instruction?

In what way is the factual statement you cite above in need of
correction?
Quote:
'ID and NAME tokens must ...
<snip>

In a javascript FAQ, if any rues that determine the legal character set
are to be cited it would make more sense to be citing the rules for a
javascript Identifier than an HTML ID attribute. In either case the
result would excessive for a "quick answer" in the FAQ.

Richard.

Closed Thread