I’m gathering a list of values from a SQL database and creating checkboxes and text fields that store the values in an array… I want to be able to dynamically have the user either check, or uncheck the checkbox so that the corrisponding checkbox will be enabled or disabled..
here is the javascript I’m using:
[CODE]<SCRIPT LANGUAGE=”JavaScript”><!–
function enabledisable(whatNum) {
if(document.frmUpdateUser.chkType[whatNum].checked) {
document.frmUpdateUser.numMonth[whatNum].disabled=false;
} else {
document.frmUpdateUser.numMonth[whatNum].disabled=true;
document.frmUpdateUser.numMonth[whatNum].text=””;
}
}
//–>
</SCRIPT>
And here is an example of part of the form that I want it to enable and disable.. this is AFTER the ASP has displayed the the check boxes and text boxes:
[CODE]<tr>
<td><input class=”checkBoxes” name=”chkType[]” type=”checkbox” value=”1″ onClick=”enabledisable(1)” checked /> Driving Record<br></td>
<td valign=”top”>Allowed Per Month: <input name=”numMonth[]” type=”text” class=”checkBoxes” style=”width:20px” value=”5″ /></td>
</tr>
<tr>
<td><input class=”checkBoxes” name=”chkType[]” type=”checkbox” value=” 2″ onClick=”enabledisable(2)” /> Vehicle Registration<br></td>
<td valign=”top”>Allowed Per Month: <input name=”numMonth[]” type=”text” disabled class=”checkBoxes” style=”width:20px” /></td>
</tr>
<tr>
<td><input class=”checkBoxes” name=”chkType[]” type=”checkbox” value=” 3″ onClick=”enabledisable(3)” /> Credit Records<br></td>
<td valign=”top”>Allowed Per Month: <input name=”numMonth[]” type=”text” disabled class=”checkBoxes” style=”width:20px” /></td>
</tr>