title: Zend Form with Ajax and validation
body: <p>Following "logical" Problem, i have an Controller with 2 Actions:</p>
  
  <p>IndexAction: Display an Search Form, inside the view Script is an Div Tag to display search results.</p>
  
  <p>The action validates the form:</p>
  
  <pre><code>    public function indexAction()
      {
          $searchForm = new My_Form_Search();
          $statsService =  new My_Service_Statistics();
  
          if ($this-&gt;getRequest()-&gt;isPost()) {
              if ($searchForm-&gt;isValid($this-&gt;getRequest()-&gt;getParams())) {
                  $this-&gt;_forward('ajax-do-search');
              } else {
                  //???
                  // i want to display the errors
                  exit();
              }
          }
  
          $this-&gt;view-&gt;search = $searchForm;
      }
  
  public function ajaxDoSearchAction()
  {
      $this-&gt;view-&gt;result = array();
      $searchForm = new My_Form_Search();
  
      if ($this-&gt;getRequest()-&gt;isPost()) {
          if ($searchForm-&gt;isValid($this-&gt;getRequest()-&gt;getParams())) {
              $query = $searchForm-&gt;getValue('search');
              $search = new My_Service_Search();
              $hits = $search-&gt;find($query);
              // more...
  
          }
      }
  }
  </code></pre>
  
  <p>If valid it forwards to the Search action, and the view is rendered via Jquery.form in the
  defined div.</p>
  
  <p>But what to do if the server side validation failed? without "exit();" the index action is displayed
  inside the result div. </p>
  
  <p>I think the solution is simple, but to much code today :-) </p>
  
  <p>I know i can prevent this with client side validation, but i thrust php :-</p>