title: Zend form + csrf protection
body: <p>Im trying to secure my Zend form with crsf token. Allways if I add token element to my form, it always send me back notEmpty error message for token. Im I doing something wrong? Thx</p>
  
  <pre><code>class Application_Form_Test3 extends Zend_Form {
  
      public function init() {
          $this-&gt;setMethod('post');
  
  //..some elements
  
          $note = new Zend_Form_Element_Textarea('note');
          $note-&gt;addValidator('stringLength', false, array(2, 50));
          $note-&gt;setRequired(true);
          $note-&gt;class = 'form-control';
          $note-&gt;setLabel('Poznámka:');
          $note-&gt;setAttrib('placeholder', 'poznamka ke spisu');
          $note-&gt;setOptions(array('cols' =&gt; '20', 'rows' =&gt; '4'));
  
          $submit = new Zend_Form_Element_Submit('submit');
          $submit-&gt;class = 'btn btn-success';
          $submit-&gt;setValue('odeslat');
  
          $this-&gt;addElements(array(
              $number,
              $year,
              $owner,
              $note,
              $submit,
          ));
  
          $this-&gt;addElement('hash', 'no_csrf_foo', array('salt' =&gt; 'unique'));
      }
  
  }
  </code></pre>
  
  <p>Action in controller:</p>
  
  <pre><code>public function findAction() {
      $request = $this-&gt;getRequest();
      $form = new Application_Form_Test3();
  
      if ($this-&gt;getRequest()-&gt;isPost()) {
          if ($form-&gt;isValid($request-&gt;getPost())) {
              var_dump($request-&gt;getPost());
          } else {
              var_dump("ERROR");
          }
      }
  
      $this-&gt;view-&gt;form = $form;
  }
  </code></pre>
  
  <p>In my view I render form and dump error messages</p>
  
  <pre><code>...
  &lt;?php echo $form-&gt;renderForm(false); ?&gt;
  ...
  //render single elements here
  //eg.  &lt;?php echo $form-&gt;note-&gt;renderViewHelper(); ?&gt;
  ...
      &lt;?php var_dump($form-&gt;getMessages()) ?&gt;
  ...
  </code></pre>
  
  <p>After each validation of form, i get array of error messages like that:</p>
  
  <pre><code>array(2) { ["note"]=&gt; array(1) { ["isEmpty"]=&gt; string(36) "Value is required and can't be empty" }  ["no_csrf_foo"]=&gt; array(1) { ["isEmpty"]=&gt; string(36) "Value is required and can't be empty" } } 
  </code></pre>
  
  <p>if I fill good values to elements, the last one error is always for token - NotEmpty, so my form is never valid.</p>