title: Javascript Confirm continues regardless of user answer
body: <p>I have an html template that I use with my Django website code.  In the template are a couple of forms. Two of the forms are datefields and I have a <em>confirm</em> popup that is activated on submission if the user fills them in.  I wanted the popup to exit the form submission and return to the page if the user clicks 'cancel', and to continue submitting the form if the user clicks 'ok'.  </p>
  
  <p>The confirm popup shows up correctly but the form submission continues no matter what the user clicks.  How do I change it so that the form submission exits if the user clicks 'cancel'?</p>
  
  <p>Javascript looks like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var checkFields = ["SPAN_START","SPAN_END"];
      function checkForm( theForm ) {
  
        for (i in checkFields ) {
          var fieldName = checkFields[ i ];
          var theField = theForm[ fieldName ];
  
          if ( theField.value ) {
            var retVal = confirm("Are you sure you want to specify a date?");
            if (retVal == true){
              theField.submit()
              return true;
            } else {
              return false;
            }
          }
        }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>The html where it is used looks like this:</p>
  
  <pre><code>&lt;form action="/InterfaceApp/Nominal_Request/" method="post" class="form" onsubmit="checkForm( this )"&gt;
    {% csrf_token %}
    &lt;div class="panel-body text-center"&gt;
      {% bootstrap_form form_span_start %}
      {% bootstrap_form form_span_end %}
      {% buttons %}
      &lt;button type="submit" class="btn btn-primary center-block" value="Submit" name="Range"&gt;
        {% bootstrap_icon "fire" %} Generate Range of Requests
      &lt;/button&gt;
      {% endbuttons %}
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Can anyone tell me how to cancel the submission of the form if the user clicks 'cancel'??</p>
  
  <p>Much appreciated.</p>