Page 1 of 1

drop down menu question

Posted: Sat Jul 17, 2004 4:27 am
by John Cartwright
how do you make it so when a drop down item is selected the form is submitted?

any help is much appreciated TY!

Posted: Sat Jul 17, 2004 4:59 am
by kettle_drum
onClick(document.form.submit);

Posted: Sat Jul 17, 2004 8:44 am
by feyd
onchange=""

actually..

use this.options[this.selectedIndex].value to retrieve the value (within the page).

Posted: Sat Jul 17, 2004 3:10 pm
by John Cartwright
after a google i come up with this

Code: Select all

<?php
<select name="mapsearch" onChange="document.form.submit();" >
?>
but it gives me the error:
blah blah document.form is not an object or is null

Posted: Sat Jul 17, 2004 3:17 pm
by John Cartwright
omg im so stupid forgot to rename the form name :P

Posted: Sat Jul 17, 2004 8:13 pm
by feyd
this.form.submit() works too ;)

Posted: Tue Jul 20, 2004 1:21 pm
by Vincent Puglia
Hi,

any of the following would work:

Code: Select all

<select name="mapsearch" onChange="document.formname.submit();" >
 // where formname is the actual name of the form.
<select name="mapsearch" onChange="document.forms&#1111;'formname'].submit();" > 
// same as above
<select name="mapsearch" onChange="document.forms&#1111;0].submit();" > 
// where the form is the first form on the page -- forms&#1111;1] the second form, etc...
<select name="mapsearch" onChange="this.form.submit();" > 
// feyd's suggestion and the most often used.
Vinny

feyd | added

Code: Select all

tags [/color]