title: JavaScript code to stop form submission
body: <p>One way to stop form submission is to return false from your JavaScript function.</p>
  
  <p>When the submit button is clicked, a validation function is called. I have a case in form validation. If that condition is met I call a function named <strong>returnToPreviousPage();</strong></p>
  
  <pre><code>function returnToPreviousPage() {
      window.history.back();
  }
  </code></pre>
  
  <p>I am using JavaScript and <a href="http://en.wikipedia.org/wiki/Dojo_Toolkit">Dojo Toolkit</a>.</p>
  
  <p>Rather going back to the previous page, it submits the form. How can I abort this submission and return to the previous page?</p>