title: Symfony2 Submitting a form to a different controller and check isValid()
body: <p>I am submitting a form to a different controller than the one outputting the form. </p>
  
  <p>My question is how do you check the submitted data is valid?</p>
  
  <p>I have tried several things. the main thing I want to validate is "_token" </p>
  
  <p>How do  I do this? </p>
  
  <p>This is a sample of my code.</p>
  
  <pre class="lang-php prettyprint-override"><code>/*
  Out put the search form
  */
  public function searchAction(Request $request)
  {
  $form = $this-&gt;createFormBuilder()
      -&gt;setAction($this-&gt;generateUrl('email_search'))  # &lt;- route to the search process controler
  -&gt;setMethod('GET')
  -&gt;add('userSearch', 'text',array(
          'required' =&gt; true,
          'label' =&gt; false,
          'attr' =&gt; array(
              'placeholder' =&gt; 'Search User Email',
                      )
                    )
          )
              -&gt;add('Serch', 'submit')
              -&gt;getForm();
  
      return $this-&gt;render(
                      'TwigBundle:Search:Search.html.twig', 
                      array(
                          'form' =&gt; $form-&gt;createView( )
                      )
                  );
  
  }
  
  /*
  Process the search
  */
  public function emailResultsAction(Request $request){
  
      $form = $this-&gt;createFormBuilder()-&gt;getForm();
      $form-&gt;handleRequest($request);
      if ($form-&gt;isValid()) {
          $ret = $_POST;
      }else{
          $ret = 'failed';
      }
      /*
      ... Process the search
      */
      return new Response(print_r($ret));
  
  }
  </code></pre>
  
  <p>This gives the error:</p>
  
  <pre><code>"Call to undefined function Acmy\UserBundle\Controller\getForm() in xxxxxxx"
  </code></pre>
  
  <p>I can validate the search myself but I do not know how to validate the _token.</p>
  
  <p>This does not seem to be covered in the Symfony2 documentation.</p>
  
  <p>Thanks in advance.</p>