php - How to set a class attribute to a Symfony2 form input -



php - How to set a class attribute to a Symfony2 form input -

how can set html class attribute form <input> using formbuilder in symfony2 ?

something this:

->add('birthdate', 'date',array( 'input' => 'datetime', 'widget' => 'single_text', 'attr' => array( 'class' => 'calendar' ) )) {{ form_widget(form.birthdate) }}

i want inputfield attribute class set calendar

you can twig template:

{{ form_widget(form.birthdate, { 'attr': {'class': 'calendar'} }) }}

from http://symfony.com/doc/current/book/forms.html#rendering-each-field-by-hand

php forms symfony2 input formbuilder

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -