views:

83

answers:

1

Hello, 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');
+2  A: 

Two things:

  1. The code for setting the "cols" is commented out (// in front of the line)

  2. 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.

smoove666
Very smart :-<I know that at th begining of cols line there is //.I did not remove it only so that it will provide help to others
try this code: $this->addElement('textarea', 'description', array('cols' => '4', 'rows' => '4'));
smoove666