Lock two textfields with Radio Buttons

[Total: 0    Average: 0/5]

This shows a method to have a field in a form disabled ona radio button choice to do so.

Body Code:

<form name=exf1>
<table>
<tr><td>&nbsp;</td><td>On</td><td>Off</td></tr>
<tr><td>Text1:</td><td><input type="radio" name="r1" checked onClick="document.exf1.text1.disabled=false;"></td>
                <td><input type="radio" name="r1" onClick="document.exf1.text1.disabled=true;"></td></tr> 
<tr><td>Text2:</td><td><input type="radio" name="r2" checked onClick="document.exf1.text2.disabled=false;"></td>
                <td><input type="radio" name="r2" onClick="document.exf1.text2.disabled=true;"></td></tr> 
</table>
<input name="text1" onFocus="if(document.exf1.text1.disabled)blur();"> 
<input name="text2" onFocus="if(document.exf1.text2.disabled)blur();"> 
</form>

Times Viewed: 2

Leave a Reply

Your email address will not be published. Required fields are marked *