title: stop jquery to run server side code on validation fail
body: <p>Sorry for the very basic question but i am asking here after trying to search alot.</p>
  
  <p>Basically i am doing client side validation its running the half code but it is running the php code also even if it fails.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function formValidation(){
          if($("#inputCname").val() == ''){
              alert("Category missing");
              ($this).css("border-color","red");
              return false;
          }
          return true;
      };
  &lt;/script&gt;
  </code></pre>
  
  <p>Below i am calling the function. Please note that i have already tried with onclick event on the submit button still not working.</p>
  
  <pre><code>&lt;form class="form form-search" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST" enctype="multipart/form-data" onsubmit="formValidation();"&gt;
  </code></pre>
  
  <p>Thanks alot.</p>