bee*_*bee 2 php zend-framework
我正在使用Zend Frameworks ViewHelpers.我试图传递一些东西来设置SELECT中的禁用属性.例如,如果
$countries = array(1=>'Select Option', 2=>'us', 3=>'uk')
Run Code Online (Sandbox Code Playgroud)
和
formSelect('country','us',null,$this->countries)
我需要先拨打第一个选项,即"选择选项"
你有什么主意吗 ?
谢谢你的补充
我不认为你可以禁用一个元素?如果你禁用它然后为什么要它?
您只能禁用整个<select>输入.
建议您编写验证以不接受第一个元素.
OP关于能够做到这一点的评论后编辑
这是另一个答案
// Get the countries element (do this after adding your options), then set the
// attribute disable for option '1'
$form->getElement("countries")->setAttrib("disable", array(1));
Run Code Online (Sandbox Code Playgroud)
这个建议在这里
| 归档时间: |
|
| 查看次数: |
6536 次 |
| 最近记录: |