...

View Full Version : Disabling fields



Darren06
06-02-2004, 11:46 PM
How would I make it so if say an option field with yes or no is selected on yes in the current page, other fields become disabled in the current page based on what is selected.

glenngv
06-03-2004, 03:23 AM
<form>
<input type="radio" name="answer" value="1" onclick="enableDisableFields(this)" />Yes
<input type="radio" name="answer" value="0" onclick="enableDisableFields(this)" />No
</form>

function enableDisableFields(rad){
var oForm = rad.form;
var state = new Boolean(rad.value).valueOf(); //convert '1' to true and '0' to false
oForm.theField.disabled=state;
oForm.theField2.disabled=state;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum