title: JavaScript radio button confirmation
body: <p>I am trying to add a function, or additional JavaScript to the existing function for a confirmation. I will need a confirmation box once the submit button is clicked saying, "You have chosen (either GCSE, A2 or AS), is this correct?" There should be a cancel button to return to the form or an OK which lets the form be submitted.</p>
  
  <p>Here is the code, I did a little research and it said use a loop, I am very new to this so I don't know what to do.</p>
  
  <pre><code>&lt;head&gt;
  &lt;title&gt;Exam entry&lt;/title&gt;
  &lt;script language="javascript" type="text/javascript"&gt;
  
  function validateForm() {
  var result = true;
  var msg="";
  if (document.ExamEntry.name.value=="") {
  msg+="You must enter your name \n";
  document.ExamEntry.name.focus();
  document.getElementById('name').style.color="red";
  result = false;
  }
  
  if(msg==""){
  return result;
  }
  {
  alert(msg)
  return result;
  }
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Exam Entry Form&lt;/h1&gt;
  &lt;form name="ExamEntry" method="post" action="success.html"&gt;
  &lt;table width="50%" border="0"&gt;
  &lt;tr&gt;
  &lt;td id="name"&gt;Name&lt;/td&gt;
  &lt;td&gt;&lt;input type="text" name="name" /&gt;&lt;/td&gt;
  &lt;tr&gt;
  &lt;td id="subject"&gt;Subject&lt;/td&gt;
  &lt;td&gt;&lt;input type="text" name="subject" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td id="examnumber"&gt;Examination Number&lt;/td&gt;
  &lt;td&gt;&lt;input type="text" name="examnumber" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;input type="radio" id="examtype" name="examtype" /&gt; : GCSE&lt;br /&gt;
  &lt;td&gt;&lt;input type="radio" id="examtype" name="examtype"  /&gt; : A2&lt;br /&gt;
  &lt;td&gt;&lt;input type="radio" id="examtype" name="examtype" /&gt; : AS&lt;br /&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;input type="submit" name="Submit" value="Submit" onclick="return validateForm();"    /&gt;  &lt;/td&gt;
  &lt;td&gt;&lt;input type="reset" name="Reset" value="Reset" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>