我有一个Zend Form,它的一个字段是Textarea。我已经使用“行”和“列数”设置了它的默认大小,但是我希望用户不能更改它。
我尝试添加'resize'=> false,但是没有用。
public function __construct()
{
parent::__construct('form');
$this->setAttribute('method', 'post');
$this->setAttribute('role', 'form');
$this->add([
'name' => 'feedback',
'type' => Textarea::class,
'attributes' => [
'id' => 'feedback',
'class' => 'mdc-text-field__input',
'rows' => 3,
'cols' => 4,
'required' => false,
],
'options' => [
'label' => 'Feedback',
],
]);
}
答案 0 :(得分:0)
您可以选择
attributes => [
...,
'style' => 'resize:none'
]
或使用CSS类
attributes => [
...,
'class' => 'notresizable'
]
并在css文件中定义此css类。