title: How to handle jQuery Validation errors
body: <p>I have a form that i'm validating with some required fields in it. i'm using the jquery.validate plugin to validate the form. below is the snippet:
  Js:</p>
  
  <pre><code>    var validator = $("#accountCreateForm").validate({
  
      // Specify the validation rules
      rules: {
          firstname: "required",
          lastname: "required",
          email: {
              required: true,
              email: true
          }
      },
  
      // Specify the validation error messages
      messages: {
          firstname: "Please enter your first name",
          lastname: "Please enter your last name",
  
          email: "Please enter a valid email address"
      }
  
  });
  $('#button').on("click", function(){
    $.wm.net.restRequest('/account/data',{
       //post the required data
    }).fail(function() {
      // do the error handling
    }).done(function() {
      //post data successfully
     });
   });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code> &lt;form action="" method="post" id="register-form" &gt;
  
  &lt;div class="label"&gt;First Name&lt;/div&gt;&lt;input type="text"  name="firstname" /&gt;&lt;br /&gt;
  &lt;div class="label"&gt;Last Name&lt;/div&gt;&lt;input type="text" id="lastname" name="lastname" /&gt;&lt;br /&gt;
  &lt;div class="label"&gt;Email&lt;/div&gt;&lt;input type="text" id="email" name="email" /&gt;&lt;br /&gt;
    &lt;div style="margin-left:140px;"&gt;&lt;button id="button" type="submit" name="submit" &gt;Submit&lt;/button&gt;&lt;/div&gt;
  
   &lt;/form&gt;
  </code></pre>
  
  <p>With the above initialization of the validation plugin, the form does not validate, mainly because im not doing anything in the error handling function. I'm not sure how can i handle the validation at the error function :</p>
  
  <pre><code>}).fail(function() {
      // do the error handling
    });
  </code></pre>
  
  <p>Thanks!</p>