What am I doing now?
Using a SELECT form field to disable another field. 
Thursday, April 10, 2008, 10:32 AM - Scripts
Posted by Administrator
If you need to selectively disable fields based upon a select statement, the code to do this is pretty simple:


<form id="form1" name="form1" method="post" action="">
<label for="select"></label>
<select name="select" id="select" onChange="document.getElementById('field1').disabled=(this.selectedIndex==0)?'':'disabled'">
<option value="Y">Yes</option>
<option value="N">No</option>
</select>
<label for="field1"></label>
<input type="text" name="field1" id="field1" />
</form>


Just need to make sure that the field you're disabling has an ID set (and you use it in the select statement's onChange)
add comment   |  0 trackbacks   |  permalink   |   ( 3 / 388 )

<<First <Back | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Next> Last>>