NYCPHP Meetup

NYPHP.org

[nycphp-talk] form element arrays

rcozzol at optonline.net rcozzol at optonline.net
Mon Oct 31 17:28:32 EST 2005


just an FYI to anyone this has driven crazy ... as it did me for quite some time.

you can pass it to a javascript function this way (where elementname is the name of the select list)
this.form['elementname[]']

you HAVE to select all the items on the submit() if you want them to come across in the POST, otherwise you will end up without that post element, which becomes phase 2 of driving yourself crazy.

----- Original Message -----
From: Tim Gales <tgales at tgaconnect.com>
Date: Monday, October 31, 2005 5:22 pm
Subject: Re: [nycphp-talk] form element arrays

> Marc Antony Vose wrote:
> 
> >I have a select element for which I need to return multiply 
> selected 
> >items to PHP.  In other words, I guess it has to have the name 
> >'something[]', with brackets.
> >
> >However, I also need to add options to the select list via 
> >javascript, but it seems like the addition of the brackets makes 
> the 
> >form element name invalid, by javascript's standards, since you 
> >access attributes of objects with brackets (i.e., JavaScript 
> can't 
> >see an element named 'something[]').
> 
> Maybe getElementById() can help.
> 
> see:
> http://lists.nyphp.org/pipermail/talk/2004-July/011083.html
> and
> http://lists.nyphp.org/pipermail/talk/2004-July/011100.html
> 
> 
> -- 
> T. Gales & Associates
> 'Helping People Connect with Technology'
> 
> http://www.tgaconnect.com
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 



More information about the talk mailing list