By default Zend Form Text elements don\'t have a width specified. Textarea elements have a default of rows="24"
and cols="80"
. But
Generally it is good practice to add your form attributes in your fieldset class (or form class depending on how you have set it up).
Here is an example:
class SomeFieldSet extends Fieldset
{
/**
* @var \Doctrine\Common\Persistence\ObjectManager
* @access protected
*/
protected $objectManager;
/**
* @param ObjectManager $objectManager
* @param SomeEntity $claimPrototype
* @param null $name
* @param array $options
*/
public function __construct(
ObjectManager $objectManager,
SomeEntity $somePrototype,
$name = null,
$options = array()
) {
parent::__construct($name, $options);
$this->objectManager = $objectManager;
$this->setHydrator(new DoctrineObject($objectManager));
$this->setObject($somePrototype);
}
public function init()
{
$this->add(
[
'name' => 'description',
'type' => 'textarea',
'options' => [
'label' => 'Some Label',
'instructions' => 'Some instruction',
],
'attributes' => [
'class' => 'form-control',
'placeholder' => 'Some placeholder',
'required' => 'required',
'rows' => 10
],
]
);
}