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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple form question

Status
Not open for further replies.

markemark

Instructor
Nov 11, 2003
21
GB
Is it possible to enable and disble a command button based on a drop down box selection?

Regards
mark
 
Simple answer - yes

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
<script>
function checkSelect(){
theSelect = document.getElementById(&quot;mySelect&quot;)
if (theSelect.selectedIndex == 3){
document.getElementById(&quot;theButton&quot;).disabled = true
}
else{
document.getElementById(&quot;theButton&quot;).disabled = false
}
}
</script>

<select id=&quot;mySelect&quot; onChange=&quot;checkSelect()&quot;>
<option>works
<option>works
<option>works
<option>Disables
</select>

<input type=&quot;button&quot; id=&quot;theButton&quot; value=&quot;Some Button&quot;>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top