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:Posted by Administrator
<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)




( 3 / 388 )

Calendar
