title: Stop form submission when using JavaScript
body: <p>I have a form where user enter a cnic number if this number is less than 15 then alert a msg and stop the form submission but issue is that form submission cannot stop when the <code>cnic</code> number is less than 15.</p>
  
  <pre><code>&lt;script&gt;
      function validateform()
      {
  
          var cnic1 = document.getElementById("cnic1").value;
          if (cnic1.length &lt; 15)
          {
              window.alert("Invalid CNIC");
              cnic1.focus();
              return false;
          }
      }
  &lt;/script&gt;
  
  &lt;form class="col s12" action="tabs.php" method="post" enctype="multipart/form-data" name="applyform"&gt;
  
      &lt;div class="row"&gt;
          &lt;div class="input-field col s1"&gt;&lt;/div&gt;
          &lt;div class="input-field col s4"&gt;&lt;label&gt;CNIC No. &lt;/label&gt;
              &lt;font style="color: #ff0000"&gt;*&lt;/font&gt;
          &lt;/div&gt;
          &lt;div class="input-field col s6"&gt;
              &lt;input id="cnic1" name="cnic1" type="text" value="&lt;?php echo $RowAcc['cnic'];?&gt;" maxlength="15" placeholder="CNIC #" required&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Is there issue in php submission code write on <code>tabs.php</code> page that's why form still submitting process?</p>