title: How to check if one of radio buttons was selected?
body: <p>I have JavaScript which checks for text fields and check boxes fine but when comes to radio buttons it fails to distinguish if one of the options was selected. </p>
  
  <p>How to do this correctly?</p>
  
  <p>This is what I have:</p>
  
  <pre><code>validateBugForm = function()
  {
      var name = document.forms["bug_form"]["Name"].value;
      var email = document.forms["bug_form"]["Email"].value;
      var tos = document.forms["bug_form"]["Accept"].checked;
      var project = document.forms["bug_form"]["project"].value;
  
      if (name == "")
      {
          alert("You must provide your name or nick name!");
          return false;
      }
  
      if (project == "")
      {
          alert("You must choose a project.");
          return false;
      }
  
      if (email.indexOf ('@', 0) == -1 || email.indexOf ('.', 0) == -1)
      {
          alert("You must provide your email address!");
          return false;
      }
  
      if (!tos)
      {
          alert("You must agree to our Terms of Services.");
          return false;
      }
  }
  </code></pre>
  
  <p>In my form I have:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td width="30%"&gt;Choose a project in which you encountered a problem. 
      &lt;big&gt;&lt;font color="red"&gt;*&lt;/font&gt;&lt;/big&gt;&lt;/td&gt;&lt;/td&gt;
      &lt;td width="10px" class="table_td_space"&gt;&lt;/td&gt;
      &lt;td width="70%"&gt;
          &lt;input type="radio" name="project" value="1" id="1"&gt;1&lt;br&gt;
          &lt;input type="radio" name="project" value="2" id="2"&gt;2&lt;br&gt;
          &lt;input type="radio" name="project" value="3" id="3"&gt;3&lt;br&gt;
          &lt;input type="radio" name="project" value="4" id="4"&gt;4&lt;br&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>