title: Zend: Form validation: value was not found in the haystack error
body: <p>I have a form with 2 selects. Based on the value of the first select, it updates the values of the second select using AJAX. Doing this makes the form not being valid. So, I made the next change:  </p>
  
  <pre><code>        $form=$this-&gt;getAddTaskForm(); //the form
  
          if(!$form-&gt;isValid($_POST)) {
              $values=$form-&gt;getValues();
  
              //get the options and put them in $options
  
                  $assignMilestone=$form-&gt;getElement('assignedMilestone');
                  $assignMilestone-&gt;addMultiOptions($options);
  
          }
  
          if($form-&gt;isValid($_POST)) {
                 //save in the database
              }else {
                 //redisplay the form
              }  
  </code></pre>
  
  <p>Basically, I check if it is valid and it isn't if the user changed the value of the first select. I get the options that populated the second select and populate the form with them. Then I try to validate it again. However this doesn't work. Anybody can explain why? The same "value was not found in the haystack" is present.</p>