我的视图文件:
echo form_textarea('',$data['note_order'],"rows='4' cols='50'");
但是我在浏览器中得到的:
<textarea name="" cols="90" rows="12">Blablablabla</textarea>
如果我更改视图代码,例如:
$options = array(
'rows' => 4,
'cols' => 50
);
echo form_textarea('',$data['note_order'],$options);
我收到错误:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: helpers/form_helper.php
Line Number: 265
为什么我的套装不工作?
试试这个
$options = array(
'name' => '',
'rows' => '4',
'cols' => '50',
'value'=> $data['note_order']
);
echo form_textarea($options);
我发现
echo form_textarea('notes', set_value('notes'), array('rows' => '3'));
导致标记与行="10"; 不是我想要的。而
echo form_textarea(array(
'name' => 'notes',
'id' => 'notes',
'value' => set_value('notes'),
'rows' => '3'
));
(带或不带 id 元素(正确生成带有 rows="3" 的标记。
转到系统/助手/form_helper然后查找form_textarea然后注释掉
$defaults = array(
'name' => is_array($data) ? '' : $data,
// 'cols' => '40', --> this
// 'rows' => '10' --> this
);