Thursday, May 12, 2022

[FIXED] Where can I change the form text box size?

Issue

I make form in Controller like this below.

$form = $this->createFormBuilder($row)
->add('comment',null,array('label' => 'input comment'))

then in the twig file...

{{form_widget(form.commentToMutor)}}

It shows text input box,but it is too small.

How to change size of TextBox


Solution

Extending @manseuk 's answer (I don't have enough reputation to post a comment), you can also specify the html style attribute inside the form builder, if you preffer:

$form = $this->createFormBuilder($row)
   ->add('comment', null, array(
           'label' => 'input comment', 
           'attr' => array('style' => 'width: 200px')
          )
   );

Edited from html attribute for width to html style attribute.



Answered By - Dani Sancas
Answer Checked By - Mildred Charles (PHPFixing Admin)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.