Click to See Complete Forum and Search --> : Protecting Check boxes and radio buttons


mcslemon
06-27-2003, 05:52 AM
I'm looking at running a survey.

One of the requirements is to have a list of differnet subjects, and next to each subject they have a yes radio/check box to check to say yes I did that subject.

Next to the lists they are asked to choose an opinion, say Like, Ok, Dislike....something like that, but I only want them to be available for the subject chose.

So basically is displays the whole list with all the yes buttons and opinions after, but all the opinions are greyed out until they click yes.

Neil.

mcslemon
06-28-2003, 05:34 AM
Thanks for that. I made a couple of changes to it so it will re-disable should u uncheck the tick box.

<script language = "javascript">
function enableradio() {
var grp = document.form1.radiobutton;
var x, len = grp.length
for (x=0; x<len; x++) {
if (grp[x].disabled == true) {
grp[x].disabled = false;
} else {
grp[x].disabled = true;
}
}

}
</script>

....


<INPUT type="checkbox" name="checkbox" value="checkbox" onclick='enableradio()'>

<INPUT type="radio" name="radiobutton" value="radiobutton" disabled>

Thanks for your help :D

Neil.