Reputation:
This is my code to display a textarea in zendform. I show fine textarea with desired rows but if i set attribute for cols it does not add columns in it. Code is this:
$element = $this->CreateElement('textarea', 'description');
$element->setAttrib('rows', '4');
$element->setAttrib('cols', '8');
$element->setLabel('Comment');
Upvotes: 2
Views: 8477
Reputation: 4130
Use :
$text = new Zend_Form_Element_Textarea('Text');
$text->setOptions(array('cols' => '4', 'rows' => '4'));
Upvotes: 1
Reputation: 4000
Two things:
The code for setting the "cols" is commented out (// in front of the line)
are you sure that you do not set the width of the textarea in a stylesheet? Because the width overwrites the cols set in your markup.
Upvotes: 2