简体   繁体   English

将Zend Framework 2表单元素设置为禁用

[英]Set Zend Framework 2 form element to disabled

I'm having problems setting a form element to disabled. 我在将表单元素设置为禁用时遇到问题。 I thought it would be 我以为会

$dropDownForCheckBox = new Element\Select("asdf");
$dropDownForCheckBox->setOptions(['disabled', true]);

However, that does not produce the disabled attribute that I would expect. 但是,这不会产生我期望的禁用属性。

Thanks in advance for any ideas 预先感谢您的任何想法

只需使用禁用的属性,而不是设置元素选项:

$dropDownForCheckBox->setAttribute('disabled', 'disabled');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM