Quantcast
Viewing all articles
Browse latest Browse all 3

How to set a Class name using Attribute in Symfony2 Form input fields

To set a class name in your form input fields, just add a few code in your twig template as :

{ 'attr': {'class': 'class_name'} }

It will look something like this :


{{ form_row(form.Field,{ 'attr': {'class': 'class_name'}) }}

OR


{{ form_widget(form.Field,{ 'attr': {'class': 'class_name'}) }}


Viewing all articles
Browse latest Browse all 3