Results 1 to 3 of 3

Thread: Disabling Checkbox group

  1. #1
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Disabling Checkbox group

    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.

    Code:
    <!--
    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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •