php - Why is form-getData() empty? (Symfony2) -


there html form, whish contains email , password field. send controller action using post.

it works, if access inputs using $request->request->get('email')

this code doesn't works. $data empty object reason:

$form = $this->createformbuilder()         ->add('email', 'email')         ->add('pass', 'text')         ->getform();  $form->handlerequest($request); $data = $form->getdata();  return new response('email: '.$data['email']); 

try this:

$form->get('email')->getdata(); 

in twig template:

<form action="{{ path('path-to-controller') }}" method="post"> {{ form_widget }} <input type="submit" value="send"/> </form> 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -