Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can´t disable radio group

Status
Not open for further replies.

Harshmellow

Programmer
Mar 28, 2002
18
BR
´Ello,

I tried using the formname.inputname.disabled="true" statement but it only worked for text boxes, and not for the radio button group.

I have a form in which one question is a "Yes or No" one, and if the user chooses "No" he would not be able to select the next "Yes or No" question entirely, which is another radio group.

The problem is: Everything I tried did not disable the group. The code i am using is as follows for the text boxes:

function tarv(inVal) {
if (inVal == 'yes') {
formname.inputname.disabled = false;
formname.inputname.focus();
}
else {
formname.inputname.disabled = true;
}
}


and the radio which has the java code is onClick="tarv('no');". This works to disable text boxes, as I said, but now I wanted to disable a whole radio button group. How can it be done? I am doing it the same way for text box and radio group. Maybe there are differences??

Thank y´all in advance,

bl
 
if you have two radio buttons having the same name, you must treat them as an array when you manipulate them. example:

<input type=&quot;radio&quot; name=&quot;myanswer&quot; value=&quot;yes&quot;>
<input type=&quot;radio&quot; name=&quot;myanswer&quot; value=&quot;no&quot;>

in javascript, you should refere to them like this:
myanswer[0].disabled = &quot;true&quot;;
myanswer[1].disabled = &quot;true&quot;;

good luck
....:::::.... xxLargeWASP ....:::::....
 
Thank you very much! It worked fine now. Thank you again! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top