Symfony2 Form Customization

forms, symfony, twig

Solution

Use the `attr` array, as explained in the documentation:

$builder->add('history', 'textarea', array(
    'attr' => array('cols' => '5', 'rows' => '5'),
));

Problem

I want something like this: ``` <textarea rows="30" cols="70" class="TextBox" style="height:100px;"> ``` but inside my symfony2 aplication and not in the twig template i tried this: ``` $builder->add('history', 'textarea', array('label' => 'Nome' , 'max_length' => 1048576 , 'rows' = 30 , 'cols' = 70)); ``` but i get "rows" and "cols" are not options... in the twig i want something like this: ``` <label for="history">{{'form_anamnese_history'}}</label> {{ form_widget(form.history) }} ``` to be a forum-post-like textbox!

Original source