Im trying to disable
a checkbox array when the corresponding radio
button is not checked. My code disables only the first element of the checkbox
array and NOT the rest of the array. I might be doing something wrong but I cant seem to figure it out.
Any help would do.
Javascript :
<script>
function radioDisable(){
if(document.getElementById('rdGrp').checked){
document.getElementById('txtUserID[]').disabled=false;
}else{
document.getElementById('txtUserID[]').disabled=true;
}
}
</script>
html :
<td>
<input type="radio" name="rdAll" id="rdAll" value="all" onchange="radioDisable()"> All Users
<br>
<input type="radio" name="rdAll" id="rdGrp" value="group" onchange="radioDisable()"> Groups
<br>
<input type="checkbox" name="txtUserID[]" id="txtUserID[]" value="SysAd"> System Admin |
<input type="checkbox" name="txtUserID[]" id="txtUserID[]" value="faculty"> Faculty |
<input type="checkbox" name="txtUserID[]" id="txtUserID[]" value="student"> Student |
<input type="checkbox" name="txtUserID[]" id="txtUserID[]" value="registrar"> Registrar |
<input type="checkbox" name="txtUserID[]" id="txtUserID[]" value="adviser"> Adviser |
<input type="checkbox" name="txtUserID[]" id="txtUserID[]" value="clerk"> Clerk |
<input type="checkbox" name="txtUserID[]" id="txtUserID[]" value="management"> Management
</td>
Aucun commentaire:
Enregistrer un commentaire