将 Zend Framework 2 表单元素设置为禁用
Set Zend Framework 2 form element to disabled
我在将表单元素设置为禁用时遇到问题。我以为会是
$dropDownForCheckBox = new Element\Select("asdf");
$dropDownForCheckBox->setOptions(['disabled', true]);
但是,这并没有产生我期望的禁用属性。
提前感谢任何想法
简单地使用禁用属性而不是设置元素选项:
$dropDownForCheckBox->setAttribute('disabled', 'disabled');
我在将表单元素设置为禁用时遇到问题。我以为会是
$dropDownForCheckBox = new Element\Select("asdf");
$dropDownForCheckBox->setOptions(['disabled', true]);
但是,这并没有产生我期望的禁用属性。
提前感谢任何想法
简单地使用禁用属性而不是设置元素选项:
$dropDownForCheckBox->setAttribute('disabled', 'disabled');