无法检查Yii2复选框字段

时间:2016-10-11 12:42:21

标签: yii2 field checked

这是我的输入脚本,它被阻止我无法检查它,并且我将属性值设置为Active我得到了错误" id权限必须是整数"

    <?php foreach(Permission::find()->all() as $key => $perm){ ?>                       

        <tr class="unread selected">
        <td>
     <div class="ckbox ckbox-theme">                                                     
    <?= $form->field($modelUserPermission, 'id_permission')->checkbox(['id' => $perm['id'],'name' => $perm['id'],'label'=>"", 'value' =>"1" ]  ); ?>

    <label for=<?=   $perm['id'] ; ?> ></label>
 </div>
                                                    </td>
    <td>
        <div class="media">

            <div class="media-body">
               <!-- <h4 class="text-primary">John Kribo</h4>-->
                <p class="email-summary"><strong><?=   $perm['description'] ; ?> </strong>    </p>

            </div>
        </div>
    </td>
</tr>               

&安培;我的模型规则

public function rules()
    {
        return [
            [['id_user', 'id_permission'], 'required'],
            [['id_user', 'id_permission'], 'integer'],
            [['date_fin'], 'safe'],
            [['id_permission'], 'exist', 'skipOnError' => true, 'targetClass' => Permission::className(), 'targetAttribute' => ['id_permission' => 'id']],
            [['id_user'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['id_user' => 'id']],
        ];
    }

0 个答案:

没有答案