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!
form_widget(form_view, variables) is a Twig function to render the HTML widget of a given field. If you apply this to an entire form or collection of fields, each underlying form row will be rendered.
This form is used to export the currently displayed graphics scene to an image file or to a geometric scene description file suitable for use by one of several external renderers, which can produce a final image.
Use the attr
array, as explained in the documentation:
$builder->add('history', 'textarea', array( 'attr' => array('cols' => '5', 'rows' => '5'), ));
You can set the display attributes for textarea in Twig rather than in the form:
{{ form_widget(edit_form.comment, { 'attr': {
'style' : 'width:525px',
'rows' : '4',
'cols' : '30' }} ) }}
As mentioned above, it is better practice to set this in CSS if possible however.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With