Quantcast
Channel: Forms
Browsing latest articles
Browse All 3 View Live

Setting a default choice field selection in Symfony2

Make sure you used array. And define the default value using "data" attribute like :... ... ->add('select_type', 'choice', array('choices' => array('1' => 'Value 1','2' => 'Value 2', ........

View Article


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':...

View Article


Date format in Symfony2

$listMapper ->add('serviced_since', 'date', array('format' => 'M d, Y')) ->add('published_at', 'date', array('widget' => 'single_text')) ;

View Article
Browsing latest articles
Browse All 3 View Live