i have a little problem with the rendering of my forms.
I would like my different select box have different size.
<div >
{{ form_label(form.date_of_birth, 'date de naissance') }}
{{ form_widget(form.date_of_birth )}}
</div>
<div >
{{ form_label(form.Alimentation, 'Alimentation') }}
{{ form_widget(form.Alimentation)}}
</div>
This two widgets renders select box. I want the two to have a different size, one large, one thin.. But, i can’t directly set the style of the , and set the width of the div does nothing.
I also tried this:
->add(‘date_of_birth’, ‘date’, array(‘required’ => false, ‘attr’ => array(‘style’ => ‘width:330px’ ),
‘widget’ => ‘choice’,
‘format’ => ‘dd-MM-yyyy’,
‘years’ => range(1970,2012)))
This does nothing.
Explained in Twig Template Form Function Reference http://symfony.com/doc/current/reference/forms/twig_reference.html
Now you have added a class attribute to your form field with yourClass as css class. So you can style your field using css.