title: Creating forms manually in Symfony2, but still use its CSRF and isValid() functionalily
body: <p>OK, I googled this hard, but everything I find talks about Symfony forms in context of regular Symfony form processing (e.g. form_widget(), creating FormType class, etc.). I have many such forms in my Symfony project, they work great.</p>
  
  <p><strong>BUT:</strong></p>
  
  <p>I also have some pretty complex AJAX forms that I would like to build manually (using plain old HTML and JS). I do still want to utilize Symfony's Form validation capabilities and CSRF protection. However, for some reason I can't get CSRF working when using isValid() for <strong>manually</strong> created forms.</p>
  
  <p>This is an example of what I am trying to accomplish:</p>
  
  <p>In my view controller I set _token:</p>
  
  <pre><code>$_token = $this-&gt;get('form.csrf_provider')-&gt;generateCsrfToken('form');
  </code></pre>
  
  <p>In my view (<strong>manually</strong> created form) (getting _token from my view controller):</p>
  
  <pre><code>&lt;html&gt;
    &lt;form method="post"&gt;
      &lt;input type="hidden" name="form[_token]" value="{{ _token }}"&gt;
      &lt;input type="hidden" name="form[id]" value="1"&gt;
      &lt;input type="submit" value="Submit"&gt;
    &lt;/form&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In my action controller (when form submitted, I am TRYING to do the following):</p>
  
  <pre><code>//Create form (for validation purposes)
  $form = $this-&gt;get('form.factory')
    -&gt;createBuilder('form', array('id' =&gt; $request-&gt;get('id')))
    -&gt;add('id', 'hidden')
    -&gt;getForm();
  
  //Bind form
  $form-&gt;bind($request)
  
  //Validate form
  if($form-&gt;isValid()) {
    //... save data
  }
  
  //Return response...
  </code></pre>
  
  <p>For some reason I can't get isValid() working, I suspect that my _token is thing not properly used, but I am out of ideas why. Have anyone actually made manually forms work with Symfony components? Does anyone have any suggestions on how to make this work?</p>
  
  <p>Basically, what I want to accomplish is:</p>
  
  <ol>
  <li><p>Manually create HTML form (with CSFR protection and <strong>without</strong> TWIG form widget functions)</p></li>
  <li><p>Use Symfony's form functionality to validate that form</p></li>
  </ol>
  
  <p>Thank you.</p>