Yii2 活跃形式
<?= $form->field($model, 'pid')->dropDownList([1=>1,2=>2])->hint('上级分类') ?>
我想禁用选项2=>2。
有办法做到吗?
您可以使用“选项”键为下拉列表中的所有项目添加属性。假设您想禁用第二项。
<?= $form->field($model, 'pid')->dropDownList([1 => 1, 2 => 2], ['options' => [2 => ['disabled' => true]]])->hint('上级分类') ?>
在文档中:http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#activeDropDownList()-detail http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#activeDropDownList()-detail
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)