Click to See Complete Forum and Search --> : Dynamically check radio buttons


Padrill
06-25-2003, 05:11 AM
<input name="rqradioGender" type="radio" value="Male"> Male
<input name="rqradioGender" type="radio" value="Female"> Female


How can I dynamically check a radio button according to a variable's value when in order for radio buttons to work exclusively they have to have the same name?

rqradioGender.value = value doesn't seem to work

Note: rqradioGender.checked = true; always checks 'Female'.

Thanx

requestcode
06-25-2003, 06:45 AM
There actually in an array so you can try this:
document.form_name.rqradioGender[0].checked=true
document.form_name.rqradioGender[1].checked=true

rwaring
09-22-2004, 02:07 PM
Why won't this work?

function GILLIGAN(){
if(document.form.radiobuttonname1[0].checked == true){
document.form.radiobuttonname2[0].checked = true;
}
}

It keeps saying Object expected

I'm calling it with an Onclick="GILLIGAN();" on a radio button in the form

There are multiple radio buttons with the same name, but diferent values in both the radiobuttonname1 and radiobuttonname2 areas

Any help is appreciated.

rwaring
09-22-2004, 02:30 PM
Nevermind, ended up using a different way to do it.