title: Render Individual Form Element in Symfony 2
body: <p>I'm having trouble rendering individual form fields in a twig template from a Symfony 2 form. In the example below, I'm simply trying to render the first_name form field.</p>
  
  <p>Also, form_errors never renders anything. </p>
  
  <p>Here is my Form object:</p>
  
  <pre><code>namespace ABC\WebsiteBundle\Form;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  
  class LoanApplication extends AbstractType
  {
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
      $builder-&gt;add('first_name', 'text', array('required' =&gt; true));
    }
  
    public function getName()
    {
      return 'LoanApplication';
    }
  
    public function getDefaultOptions(array $options)
    {
      return array(
          //'data_class'      =&gt; 'Acme\TaskBundle\Entity\Task',
          'csrf_protection' =&gt; true,
          'csrf_field_name' =&gt; '_token',
          // a unique key to help generate the secret token
          'intention'       =&gt; 'loan_application',
      );
    }
  }
  </code></pre>
  
  <p>Here is the controller:</p>
  
  <pre><code>namespace ABC\WebsiteBundle\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use JML\WebsiteBundle\Form\LoanApplication;
  use JML\WebsiteBundle\QuickBase as QuickBase;
  
  class ApplyController extends Controller
  {
    public function indexAction()
    {
      $form = $this-&gt;createForm(new LoanApplication());
      return $this-&gt;render('ABCWebsiteBundle:Apply:index.html.twig', array(
              'form' =&gt; $form-&gt;createView(),
          ));
  
      if ($request-&gt;getMethod() == 'POST') {
          $form-&gt;bindRequest($request);
  
          if ($form-&gt;isValid()) {
              // perform some action, such as saving the task to the database
  
              //return $this-&gt;redirect($this-&gt;generateUrl('task_success'));
          }
      }
    }
  }
  </code></pre>
  
  <p>And the twig:</p>
  
  <pre><code>&lt;form action="{{ path('apply') }}" method="post" {{ form_enctype(form) }}&gt;
  &lt;pre&gt;
  {{ dump(form_errors(form)) }} // always empty
  &lt;/pre&gt;
  &lt;div&gt;
      {{ form_label(form.first_name) }} // this renders
      {{ form_widget(form.first_name) }} //empty
      {{ form_row(form.first_name) }}  //empty
  &lt;/div&gt;
    &lt;input type="submit" formnovalidate/&gt;
  &lt;/form&gt;
  </code></pre>