Symfony2 formBuilder setAttribute not working.
When getAttributes return right value.
But at render it doesn't take effect
like
$form=$this->createFormBuilder();
$form->setAttribute('name','thename');
$form=$form->getForm();
return $this->render('AcmeDemoBundle:Form:testingForm.html.twig',array('testingForm'=>$form->createView() ));
I had the same problem. Neither setAttribute nor setAttributes works.
So I pass options like this:
$this->createFormBuilder(null, array(
'attr' => array(
'class' => 'delete-action-form'
)
));
Check the docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With