Re: [PHP] formular multiple select trouble

2001-10-02 Thread Jason G.

Give the select tag an ID.  You can then reference the element by its ID.

select name=aname[] id=aname

javascript
 alert(aname.value);
/javascript

-Jason Garber
IonZoft.com


At 01:25 PM 10/2/2001 +0200, Sebastian wrote:
Hi all

If i use multiple select fields in a from
i use name[] to access it in php afterwards
select name=aname[] multiple
optiontest1/option
optiontest2/option
/select

i can then access in php $name and it has its the elements that were
selected.
my problem now is that i can't access name[] with javascript...
if i try
javascript
 alert(document.fo.neme[].value);
/javascript
gives an error...

is there another way to neme the seletc field?
if i use name=aname
then i only get one selected value in php.

thanks

sebastian


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] formular multiple select trouble

2001-10-02 Thread Iván Milanez Castellanos

Sebastian: if I remember correctly if you use a multiple selection field on
a page when you submit the form the contents of the selected items on the
field are sent via a comma delimited string, so you would just have to do
$Array=split(,, $String) to retrieve all of the selected values of the
form.

This way you can still use javascript to manipulate your form and not worry
about how many selections a user makes.

Later


 At 01:25 PM 10/2/2001 +0200, Sebastian wrote:
 Hi all
 
 If i use multiple select fields in a from
 i use name[] to access it in php afterwards
 select name=aname[] multiple
 optiontest1/option
 optiontest2/option
 /select
 
 i can then access in php $name and it has its the elements that were
 selected.
 my problem now is that i can't access name[] with javascript...
 if i try
 javascript
  alert(document.fo.neme[].value);
 /javascript
 gives an error...
 
 is there another way to neme the seletc field?
 if i use name=aname
 then i only get one selected value in php.
 
 thanks
 
 sebastian




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]