NYCPHP Meetup

NYPHP.org

[nycphp-talk] form element arrays

Marc Antony Vose suzerain at suzerain.com
Mon Oct 31 16:54:07 EST 2005


Hi there:

Honestly, I'm posting this before I've completely exhausted my 
troubleshooting options, but I figured someone might be bored enough 
to beat me to it.

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[]').

It looks like I'm going to have to use the select list to just 
display the options to the user, but really use DOM to dynamically 
add hidden form elements to the form which hold the values I need, as 
a nasty workaround, but I was wondering if anyone else had any silver 
bullet for this.

Cheers,

-- 
Marc Antony Vose
http://www.suzerain.com/

Never underestimate the power of human stupidity.
-- Lazarus Long



More information about the talk mailing list