Connecting Tech Pros Worldwide Help | Site Map

field names in javascript

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 12:00 PM
dan
Guest
 
Posts: n/a
Default field names in javascript

I need to use a different type of name for a field in a form. does
anyone know how I can access this with this kind of name?

<input type="text" name ="id[txt_3]" size="6" maxlength="6" value="">

now how can I access this name in javascript?
//this doesn't work??

document.form_name.id[txt_3].value
document.form_name.?????????.value

  #2  
Old July 20th, 2005, 12:00 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default Re: field names in javascript

ryan000@yahoo.com (dan) writes:
[color=blue]
> I need to use a different type of name for a field in a form. does
> anyone know how I can access this with this kind of name?
>
> <input type="text" name ="id[txt_3]" size="6" maxlength="6" value="">[/color]

<URL:http://jibbering.com/faq/#FAQ4_39>
might help you.

(then read it all :)
/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
  #3  
Old July 20th, 2005, 12:01 PM
Michael Winter
Guest
 
Posts: n/a
Default Re: field names in javascript

Lasse Reichstein Nielsen wrote on 20 Nov 2003:
[color=blue]
> <URL:http://jibbering.com/faq/#FAQ4_39>
> might help you.[/color]

It will almost. It doesn't say in the FAQ that square brackets are
illegal characters in control names. The original poster should see
my reply in his earlier thread (also started today).

Mike

--
Michael Winter
M.Winter@blueyonder.co.uk.invalid (remove ".invalid" to reply)
  #4  
Old July 20th, 2005, 12:01 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default Re: field names in javascript

Michael Winter <M.Winter@blueyonder.co.uk.invalid> writes:
[color=blue]
> It doesn't say in the FAQ that square brackets are illegal
> characters in control names. The original poster should see my reply
> in his earlier thread (also started today).[/color]

It does, I just omitted the reference because they are not illegal
(see my reply to your reply :)

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
  #5  
Old July 20th, 2005, 12:01 PM
Richard Cornford
Guest
 
Posts: n/a
Default Re: field names in javascript

"Michael Winter" <M.Winter@blueyonder.co.uk.invalid> wrote in message
news:Xns9439EFDECCA6MWinterBlueyonder@193.38.113.4 6...[color=blue]
>Lasse Reichstein Nielsen wrote on 20 Nov 2003:
>[color=green]
>> <URL:http://jibbering.com/faq/#FAQ4_39>
>> might help you.[/color]
>
>It will almost. It doesn't say in the FAQ that square
>brackets are illegal characters in control names. The
>original poster should see my reply in his earlier thread
>(also started today).[/color]

It turned out that square brackets are legal characters in the strings
provided as values to name attributes. The restrictions you mentioned in
that post do apply to ID attributes but not name (which are just CDATA).

Prior to the discussion of legal characters in name attribute strings I
also believed that those additional restrictions applied to name
attributes as well as IDs. But cross referencing the fragment
identifiers on the links used in (HTML versions of) the DTDs with the
fragment identifiers used within the UL/LI element/s used in the "SGML
basic types" sections of "types.html" in HTML specifications at the W3C
made it clear that NAME and ID "tokens" are distinct from CDATA.

Richard.


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.