Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling submit button until dropdown menu used 1

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi,

If I have a drop down menu...

<form name="form" method="post" action="go.asp">

<select name="UserID">
<option value="">Please Selectio</option>
<option value="1">Tom</option>
<option value="2">Dave</option>
<option value="3">Pete</option>
</select>

...and a submit button....

<input name="submitbutton" type="submit" value="Go">

</form>

...how can I disable the submit button if UserID is "" and enable it if it's 1, 2 or 3?

I guess I will have a function that is called using onChange and I suppose it will have something like form.submitbutton.disabled=true and form.submitbutton.disabled=false but beyond that I don't really know what I'm doing.

Thanks very much

Ed
 
Hi

Code:
<select name="UserID" [red]onchange="this.form.submitbutton.disabled=this.options[this.selectedIndex].value==''"[/red]>

<input name="submitbutton" type="submit" value="Go" [red]disabled="disabled"[/red]>

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top