dropDownList() [ 1.1 版本 ]
报错
Call to a member function dropDownList() on a non-object
请问怎么解决
共 6 个回答
-
johnny1991 回答于 2017-10-20 13:54 举报
从错误信息上可以知道,你的$form应该是null
-
-
[ 'attribute' => 'status', 'label' => '状态', 'format' => 'raw', 'value' => function($model) { return Html::dropDownlist('status', $model->status, ['上架', '下架'], ['class' => 'form-control', 'onchange' => 'change("change-status",{status:this.value,id:' . $model->id . '})']); }, 'filter' => ['上架', '下架'] ],
this_summer 觉得很赞 -
<?= $form->field($model, 'status')->dropDownList(['5'=>'启用','1'=>'关闭']) ?>
this_summer , yidashi 觉得很赞 -
-
这个里面你能学到很多东西
<?= $form->field($model, 'bus_type_res_id', ['template' => '{label}<div class="col-sm-8" style="display: inline-flex">{input}' . '{hint}{error}</div>', 'options' => ['class' => 'col_5']]) ->dropDownList(ArrayHelper::map($data['bus_type']['data'], 'res_id', 'res_name'), ['class' => 'form-control ', 'style' => 'width:172px;']) ?>
Steven0T 觉得很赞
this_summer 北京
注册时间:2017-04-07
最后登录:2023-06-25
在线时长:14小时55分
最后登录:2023-06-25
在线时长:14小时55分
- 粉丝2
- 金钱630
- 威望0
- 积分770