Connecting Tech Pros Worldwide Help | Site Map

field names in javascript

  #1  
Old July 20th, 2005, 01:00 PM
dan
Guest
 
Posts: n/a
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, 01:00 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a

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, 01:01 PM
Michael Winter
Guest
 
Posts: n/a

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, 01:01 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a

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, 01:01 PM
Richard Cornford
Guest
 
Posts: n/a

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.


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to process ONIX XML file with dupicate field names? rotsjke@gmail.com answers 1 October 14th, 2008 04:55 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound answers 2 September 28th, 2006 03:35 PM
unicode/ascii codes in javascript Randell D. answers 13 July 23rd, 2005 06:39 PM
Repeated field names in a form... Standard behavior? Andres Eduardo Hernando answers 10 July 20th, 2005 06:25 PM