title: Zend_Form csrf validation for ajax queries
body: <p>Here is how I add the csrf to the form</p>
  
  <p><code>$this-&gt;addElement('hash', 'csrf', array('ignore' =&gt; false));</code></p>
  
  <p>When this happens the session is created, Then when the user sends an ajax request, the values in the request are validated by creating an instance of the form, and the form is always valid for the first ajax request since the beginning of initial request which created the html output, </p>
  
  <p>When the ajax request has been sent for the second time something different happens,</p>
  
  <p>That instance of the form has a different csrf value than the originally made one, and when my code is done, the originally created session is destroyed as well, so there is no session to check the received the values against, and hence the form doesn't validated and the following error occurs.</p>
  
  <p><code>No token was provided to match against</code></p>
  
  <p>Any ideas at which event, the csrf values of the form are automatically stored in the session?</p>