title: JavaScript form error state does not stay on same page
body: <p>I'm doing a simple validation for a form. The JavaScript validation works fine and the pop up alert box appears with the correct errors, BUT, upon clicking "Ok", I get re-directed to the next page. Ideally, it is supposed to stay at the same page so that the user can amend his/her mistakes.</p>
  
  <p>This is a school project.</p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
  
  function show_alert() {
      if (document.getElementById('time1').value == document.getElementById('time2').value) alert("ERROR! You cannot book the same timing twice!")
      else if (document.getElementById('time1').value == document.getElementById('time3').value) alert("ERROR! You cannot book the same timing twice!")
      else if (document.getElementById('time1').value == document.getElementById('time4').value) alert("ERROR! You cannot book the same timing twice!")
      else if (document.getElementById('time1').value == "0") alert("ERROR! You cannot leave the first time slot blank!")
      else {}
  } 
  &lt;/script&gt;
  </code></pre>