Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] access form.element by name containing [ ]


  • From: javascript@xxxxxxxxxx (Carl Adler)
  • Subject: [Javascript] access form.element by name containing [ ]
  • Date: Tue, 18 Sep 2001 06:33:47 -0400

Possibly you should use escape and unescape
action%5Bnew%5D
might be worth looking at.
Carl

> From:  "Patrick Bierans" <pbierans@xxxxxxxx>
> Reply-To: javascript@xxxxxxxxxx
> Date: Tue, 18 Sep 2001 12:20:56 +0100
> To:  javascript@xxxxxxxxxx
> Subject: [Javascript] access form.element by name containing [ ]
> 
> "access form.element by name containing [ ]"
> 
> Hello out there.
> 
> I use checkboxes named "action[new]", "action[del]" and
> "action[upd]". I have to do it this way because it produces
> arrays in PHP making it much (!) easier for me, and I cannot
> change it.
> 
> Now I want to access the object in JavaScript by the name
> of the checkbox. I cannot use the construct 'elements[2]'
> because the position varies.
> 
> I tried theese:
> document.forms[0].action[new].click();
> document.forms[0].action\[new\].click();
> document.forms[0].action['new'].click();
> document.forms[0].'action[new]'.click();
> document.forms[0].'action\[new\]'.click();
> 
> Must I check the name of each element to get the object?
> "for each $this as element if $this.name = 'action[new]' $this.click;"
> 
> Isn't there another way?
> 
> TIA,
> Patrick Bierans
> 
> P. Bierans
> 
> -- 
> Patrick Bierans - LYNET Kommunikation AG - http://www.lynet.de
> Das Internet-Systemhaus fuer Multimedia- und Netzwerkloesungen
> Zentrale Luebeck      Fon +49-451-6131-0, Fax +49-451-6131-333
> Niederlassung Hamburg Fon +49-40-65738-0, Fax +49-40-65738-333
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> http://www.LaTech.edu/mailman/listinfo/javascript