PDA

View Full Version : Disabling Radio Buttons


orangehairedboy
03-26-2003, 02:43 AM
Hi all,

I have a form that starts with a YES/NO Radio Button Question. If the user selects no, the rest of the form is disabled using onclick="disableform(this.form);" which is this:

function disableform(TF) {
TF.textbox1.disabled=true;
TF.checkbox1.disabled=true;
}

and this works fine...but I can't seem to get it to work with Radio Buttons. Does anyone know how to do it?

Thanks!

Lewis

glenngv
03-26-2003, 02:59 AM
since grouped radio buttons must have the same name, they form an array.

function disableform(TF) {
TF.textbox1.disabled=true;
TF.checkbox1.disabled=true;
TF.radiobutton1[0].disabled=true;
TF.radiobutton1[1].disabled=true;
...
}

where radiobutton1 is the name of the radio button

orangehairedboy
03-26-2003, 07:06 AM
Ah...perfect...I thought it would be something silly like that.

Cheers!

Lewis