我正在尝试用yiiwheels选择小工具替换yii默认的选择小工具。
使用yii select小工具的代码
<?php echo $form->dropDownList($model,'branch_id', CHtml::listData(Branches::model()->findAll(array('order' => 'branch_name')),'id','branch_name'));?>
特灵得到这样的东西
<?php $this->widget('yiiwheels.widgets.formhelpers.WhSelectBox',array('name' => 'branch_id', 'size' => 'input-large', 'model' => $model, 'data' => CHtml::listData(Branch::model()->findAll(array('order' => 'branch_name')),'id','branch_name')));?>
提交表单时出现分支_id字段不能为空的错误。
如何将其与当前表单模型关联?
这里是Yiiwheels API docs的链接
1条答案
按热度按时间brc7rcf01#
而不是'名称'字段,我不得不使用'属性'字段。