title: Validate form with Javascript
body: <p>I am trying to get a validation process to work using Javascript, my form has four radio buttons and one submit button, and I wanted to make it so if the user clicks submit and no radio buttons are selected then it pops up an alert and doesn't submit the form. Here's what my form looks like:</p>
  
  <pre><code>&lt;form method="post" name="inform"&gt;
  If you checked off &lt;span style="text-decoration:underline"&gt;any&lt;/span&gt; problems, how  &lt;span style="text-decoration:underline"&gt;difficult&lt;/span&gt; have these problems made it for you to do your work take care of things at home or get along with other people?
  &lt;table id="lastquestion"&gt;
  &lt;tr&gt;
  &lt;td&gt;Not difficult at all&lt;/td&gt;
  &lt;td&gt;Somewhat difficult&lt;/td&gt;
  &lt;td&gt;Very difficult&lt;/td&gt;
  &lt;td&gt;Extremely Difficult&lt;/td&gt;
  &lt;/tr&gt;&lt;tr&gt;
  &lt;td style="text-align:center"&gt;&lt;input type="radio" value="not difficult at all" name="finalquestion" /&gt;&lt;/td&gt;
  &lt;td style="text-align:center"&gt;&lt;input type="radio" value="somewhat difficult" name="finalquestion" /&gt;&lt;/td&gt;
  &lt;td style="text-align:center"&gt;&lt;input type="radio" value="very difficult" name="finalquestion" /&gt;&lt;/td&gt;
  &lt;td style="text-align:center"&gt;&lt;input type="radio" value="extremely difficult" name="finalquestion" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;input type="hidden" value="&lt;?php echo $totalScore; ?&gt;" name="totalScore" /&gt;
  &lt;input type="submit" value="Submit Final Answer" name="submit" onclick="return validate(inform)" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And here's what the script looks like:</p>
  
  <pre><code>function validate(formCheck)
  {
      if(formCheck.finalquestion == "")
      {
          alert("Please Choose an option");
          return false;
      }
      else
      {
          return true;
      }
  }
  </code></pre>
  
  <p>But for some reason my button is submitting no matter what, Any advice here would help, thank you!</p>
  
  <p>UPDATE: I have tried selecting a radio and then alerting in the validate function and formCheck.finalquestion  prints: [object NodeList], so I don't think the value of which button is selected is going through properly.</p>