I am trying to test for the selected value of a set of radio buttons. What I am doing is testing all required form fields for values, and doing this by using a switch() on the type of field.

If the field type is a radio, then I use the getElementsByName() method on that group of radio buttons, then iterate through those testing to see of one is selected. If one is selected then I want to know the value, but when I get to that part of the code, I get the error, "radios[j] has no properties". Am I trying to use the .value property incorrectly?

Is there a better way of testing for the value?

Thanks for any help!

Code:
          for(var i = 0; i < requiredFields.length; i++)
          {
            switch(document.getElementById(requiredFields[i]).type)
            {
              case "text":
                if(document.getElementById(requiredFields[i]).value != "")
                  reveal = true;
                else
                  reveal = false;
                break;
                
              case "select-one":
                if(document.getElementById(requiredFields[i]).value != "")
                  reveal = true;
                else
                  reveal = false;
                break;
                
              case "radio":
                var radios = document.getElementsByName(requiredFields[i]);
                for(var j = 0; j < radios.length; j++)
                {
                  if(radios[j].checked == true)
                  {
                    reveal = true;
                    j = radios.length;
                  }
                  else
                    reveal = false;
                    
                  //  show/hide additional fields

// This is where I test for the value of the radio button
                  switch(radios[j].value)
                  {
                    case "zipper":
                      document.getElementById("zipperSide").disabled = "";
                      break;
                    case "No":
                      document.getElementById("zipperSide").disabled = "disabled";
                      break;
                    default:
                      break;
                  }
                }
                break;
            } // End switch
            
            if(reveal == false)
              break;
          } // End loop