How to change form input size in symfony forms?

Sometimes you need to change size (length) in html form elements input. In symfony you can do this in form configure function by using:

$this->widgetSchema[‘yourinputfield’] = new sfWidgetFormInput(array(),array(‘size’ => ‘8’,));

or by:

$this->widgetSchema[‘yourinputfield’]->setAttribute(‘size’, ‘8’);

Second version is more readable for me.

Have a nice day! ๐Ÿ™‚

Leave a Comment: