title: Zend form ajax validation on submit
body: <p>I am currently trying to validate a zend form with ajax and zend validate at the same time...</p>
  
  <p>Let me explain, my forms pops up in an iframe (fancybox) and when submitted, I need to display a "thank you" message, close the iframe and redirect the user. I planned to use ajax validation to close the fancybox iframe if success.</p>
  
  <p>I followed several tutorials <a href="http://www.zendcasts.com/ajaxify-your-zend_form-validation-with-jquery/2010/04/" rel="nofollow">http://www.zendcasts.com/ajaxify-your-zend_form-validation-with-jquery/2010/04/</a> explaining how to ajaxify your zend form to display errors for instance onblur event on a textinput.</p>
  
  <p>Everything works find onblur or over events but when I specify the click event on the submit button, my guess is that the form gets processed by zend and ajax validation doesn't work... Do you have any hints or do you see obvious mistakes??
  thanks a lot....
  the javascript:</p>
  
  <pre><code>$(function()
      {
      $('#contact').submit(function()
      {
          doValidation();                 
      });
  
  });
  
  function doValidation()
  {
      var url = '/ceramstar/public/contact/validateform';
      var data = {};
      $("input").each(function(){
              data[$(this).attr('name')] = $(this).val();
  
      });
  
  
      $.post(url,data,function(resp)
          {
          //document.write(resp);
  
                      console.log(resp);
                      alert(resp);
                      //parent.$.fancybox.close();
  
  
  
          },"json");
  }
  </code></pre>
  
  <p>the zend action:</p>
  
  <pre><code>public function validateformAction()
  {
  
      $this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender();
      $this-&gt;_helper-&gt;layout-&gt;disableLayout();
      $form = new Form_ContactForm();
  
      $form-&gt;isValidPartial($this-&gt;_getAllParams());
      //print_r($bool);
      $json = $form-&gt;processAjax($this-&gt;getRequest ()-&gt;getPost ());
      header('Content-type: application/json');
      echo Zend_Json::encode($json);
  }
  </code></pre>