Re: multiple select boxes
| From: | Joao Prado Maia | Date: | Tue, 29 Aug 2000 17:27:52 +0000 |
| Subject: | Re: multiple select boxes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14186@lists.php.net to get a copy of this message | ||
On Tue, 29 Aug 2000, Bill Zeller wrote:
> The problem is that this script stops working when I
> rename "list2" to "list2[]" (to allow for multiple
> selects) the script stops working.
>
> Secondly, is there a way to get all the values in a
> select box? I'm not just looking for all the selected
> values, but all them. This is because I'm using the
> menu swapper, and the contents of each select box
> change dynamically on the client.
Hi Bill,
Well I had the same problem a while ago. I was trying to create dynamic
input fields on a form and then use some javascript to validate the
data. However, you can't use "[]" on variable names on javascript, because
the code would eventually look like this :
writeln(this.document.form_name.inputfield[].value);
and that's invalid.
I couldn't find any way to get around this problem, so I just gave up and
created input fields like inputfield_1, inputfield_2 and then do a
dirty loop both on javascript and PHP to get the values.
I'm not sure how you can change your javascript code to handle that, but
it's worth a shot. Besides, javascript is just plain fun :)
Regards,
Joao
--
Joao Prado Maia
Web Developer
Kefta.com, Inc