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

disable drop down box

Status
Not open for further replies.

rkoya

IS-IT--Management
Joined
Jul 12, 2004
Messages
57
Location
GB
Hi,

I have 3 drop down boxes which are all active when page is loaded. I want to disable 2 if a particular option is chosen in the first one. So far example if Toyota is selected I want to grey out the other 2 dropdown fields so they cannot be selected.

EG

<select name="class" id="class" class="box3" >
<option value="NONE" selected>select a car </option>
<option value="F">Ford</option>
<option value="N">Nissan</option>
<option value="T">Toyota</option>
</select>

<select name="type" id="type" class="box3">
<option value="NONE" selected>select a car type</option>
<option value="B">2 door</option>
<option value="D">4 door</option>
</select>

<select name="ac" id="ac" class="box3">
<option value="NONE" selected>select aircon</option>
<option value="A">AC</option>
<option value="N">No AC</option>
</select>


Any help would be useful thanks.
 
Sorry should have put on this using javascript, can anyone help
 
[tt]
<select name="class" id="class" class="box3"
onchange="if (this.value=='T') {
document.getElementById('type').disabled=true;
document.getElementById('ac').disabled=true;}"
>[/tt]
 
Hi tsuji, looks like a good solution but having put that into my code I am getting javascript errors. Any idea why this may be?
 
Don't worry I sorted it out was a problem my end, thanks for the help. worked just how I wanted it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top