Codeigniter 3 textarea

时间:2015-07-29 13:10:06

标签: codeigniter textarea codeigniter-form-helper codeigniter-3

我试图将textarea中的行数限制为4但是给出错误

Message: Array to string conversion

这是我使用帮助类

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

echo form_textarea('vc_desc', set_value('vc_desc'),  $textarea_options);

2 个答案:

答案 0 :(得分:6)

使用所有选项设置$ data数组

    $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);

答案 1 :(得分: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);