2

I have tried to limit number of rows in textarea to 4 but its giving error

Message: Array to string conversion

this is my code of textarea using helper class

$textarea_options = array('class' => 'form-control','rows' => 4,   'cols' => 40);

echo form_textarea('vc_desc', set_value('vc_desc'),  $textarea_options);
Sahan Perera
  • 194
  • 2
  • 5
  • 17

2 Answers2

6

setup a $data array instead with all the options

    $data = array(
        'name'        => 'vc_desc',
        'id'          => 'vc_desc',
        'value'       => set_value('vc_desc'),
        'rows'        => '50',
        'cols'        => '10',
        'style'       => 'width:50%',
        'class'       => 'form-control'
    );

    echo form_textarea($data);
Dave
  • 1,049
  • 10
  • 6
0
Use rows and cols to get change the height and length of text area in code ignitor. 
$data = array('name' => 'SupAddress','value' =>set_value('SupAddress'), 'id'=>'SupAddress',  'class' => 'form-control' ,'readonly' => 'true' ,'rows' => '3', 'cols' => '40');

 echo Form_textarea($data);