Re: Multiple selections
| From: | Ernest E Vogelsinger | Date: | Wed, 13 Nov 2002 07:33:53 +0000 |
| Subject: | Re: Multiple selections | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124176@lists.php.net to get a copy of this message | ||
At 01:59 13.11.2002, David Rice said:
--------------------[snip]--------------------
>On Tuesday, November 12, 2002, at 07:34 PM, Ernest E Vogelsinger wrote:
>>
>> Sure it is - just name the listbox control "myvar[]" (note the angle
>> brackets). PHP will recognize this being an array, and you'll end up
>> with
>> $myvar = array('select1','select2');
>
>Is this the only way to do this?
As to my knowledge it is the only way.
>I just had to do some work with JavaScript and forms and the "myvar[]"
>name clobbered JavaScript's access to form elements by name. I had to
>do some ugly form.elements[x] looping to get at the "myvar[]" control.
I believe you can do this in JavaScript:
hf = form('myform');
he = hf.elements['myselect[]');
to get a handle to the form element.
>This kind on external language hostility is not that cool, especially
>toward such a common language as JavaScript.
I've made quite a number of JavaScripts controlled PHP dialogs containing
the [], they all work like a charm. There's only one thing you cannot do AFAIK:
myform.myvar[].value = 0;
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/