View Full Version : Inactive Textarea / Radio Button


Xiphias
05-07-2003, 08:46 PM
does anyone know the code that will make a textarea (on a form) inactive until a certain radio button or checkbox is selected? thnx

amicus
05-08-2003, 03:36 AM
javascript should be one word, for some reason it got broken up.


<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript">
function toggleState( state ) {
document.testForm.content.disabled = state;
}
</SCRIPT>
</HEAD>

<BODY>
<FORM NAME="testForm" ACTION="#" METHOD="post">
<INPUT TYPE="radio" NAME="textAreaState" VALUE="enable" CHECKED ONCLICK="javascript:toggleState( false )">Enable Text Area<BR>
<INPUT TYPE="radio" NAME="textAreaState" VALUE="disable" ONCLICK="javascript:toggleState( true )">Disable Text Area<BR>
<BR>

<TEXTAREA NAME="content"></TEXTAREA>
</FORM>
</BODY>
</HTML>