RE: [PHP] multiple select boxes
| From: | Dana dot Reed at clinicaldatacare dot com | Date: | Tue, 29 Aug 2000 22:08:24 +0000 |
| Subject: | RE: [PHP] multiple select boxes | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-14225@lists.php.net to get a copy of this message | ||
I just realized I forgot to address the second problem... To get everything from list2[] selected:
1. Use onSubmit to call a function, selectAll() for example. (You can send the name of the select
box as an argument to make it more dynamic).
2. Write selectAll function to use getHandle function (that solved your first problem) to loop
through all options, setting them to true.
Hope this helps.
med vänlig hälsning
/Dana
-----Original Message-----
From: jpm@kefta.com [SMTP:jpm@kefta.com]
Sent: Tuesday, August 29, 2000 7:29 PM
To: billzeller@yahoo.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] multiple select boxes
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