PDA

View Full Version : Disabling Checkbox group



nickg21
12-29-2006, 09:35 PM
hey everyone, this is my first post here the other forums i have been writing on haven't seemed to be able to help me with this problem. i am new at javascript and i am looking to disable a group of radio buttons as well as a group of checkboxes if one certain checkbox is clicked on my form. i have it working properly for the radio buttons but i am not sure of how to go about the other checkboxes. also there is 2 text boxes and a message box id like to disable. here is the code if anyone can help me it would be greatly appreciated.


<!--
function DisableRadioGroup(radioGroup, disable)
{
if(document.getElementById("OwnersManual").checked == true){
for(var i=0; i < radioGroup.length; i++)
{
radioGroup[i].disabled = true
}
}

else
{
for(var i=0; i < radioGroup.length; i++)
{
radioGroup[i].disabled = false
}
}
}
//-->
<input type="checkbox" ID="OwnersManual" value="ResendOwnersManual" onClick="DisableRadioGroup(ServiceName)">

the name of the checkboxes is name="ReasonsForCancellation"

thanks again in advance

jscheuer1
12-29-2006, 11:18 PM
This code doesn't show how you collected the radioGroup. Depending upon what else the form has to do (if anything), you could collect all the elementsByName or ByTagName and test for a className. You could also put all of the elements in a division or span as that element's children and check to see if they have the proper parentNode before doing anything to them. Or, all of the elements could belong to a given form and have no other elements in that particular form other than the ones you wish to manipulate. There are many variations on each of these main approaches and perhaps are other avenues. Why not post a link to your page so that we can see what you have so far and get a better idea of what you are trying to do.

nickg21
01-02-2007, 02:42 PM
http://www.netatlantic.com/test/nickgirard/ContactUs.php