title: Checking the form field values before submitting that page
body: <p>I have written following function which checks whether start_date field is not empty and displays proper message when submit button is clicked. But then it takes the control to the previous page. So user has to write again all other fields on that form.
  Is there any way to stay on that page even after prompting the error message, with all other fields value.</p>
  
  <pre><code>//JavaScript
  function checkform() {
      if(document.frmMr.start_date.value == "") {
          alert("please enter start_date");
          return false;
      } else {
          document.frmMr.submit();
      }
  }
  
  // HTML
  &lt;html&gt;
      &lt;form name=frmMr action="page1.jsp"&gt;
          Enter Start date:
          &lt;input type="text" size="15" name="start_date" id="start_date"&gt;
          &lt;input type="submit" name="continue" value="submit" onClick="checkform();"&gt;
      &lt;/form&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Thanks in advance</p>