title: jQuery: how to include validation in the ajaxForm function?
body: <p><a href="https://stackoverflow.com/questions/12381768/ajaxform-not-working-inside-the-validation-submithandler">This question</a>  has been asked, but the answer wasn't confirmed. I tried it but it didn't work. So I would like to ask the same question again (Is this appropriate? If not, please advise me what to do).</p>
  
  <p>I have a form which needs to be validates and then submitted with ajaxForm (the form contains image and file data, so submission with <code>.serialize()</code> won't work). The following are the details:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form id="myForm" action="..." method="post" enctype="multipart/form-data"&gt;
    ...
    &lt;input type="file" name="image" /&gt;&lt;br /&gt;
    &lt;input type="file" name="file" /&gt;&lt;br /&gt;
    ...
  &lt;/form&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$(document).ready(function() {
  
    $("#myForm").ajaxForm ({
  
      beforeSubmit: function() {
        $("#myForm").validate({
          onkeyup:false,
          rules: {
            ...
          },
          messages: {
            ...
          },
        });
      },
  
      success: function(returnData) {
        $('#content').html(returnData);
      }
  
    });
  
  });
  </code></pre>
  
  <p>The <code>ajaxForm</code> part is OK. But the form is simply submitted without validation. </p>