I have a problem when using checkBoxList

I have a problem when using CActiveForm.checkBoxList

view file:




<?php echo $form->checkBoxList($model,'rightArray',array(

                    '1'=>'create',

                    '2'=>'update',

                    '3'=>'delete',

                    '4'=>'view',

                    ),array('separator'=>'<br />','template'=>'{input} {label}')); ?>




model file:




class Manager extends CActiveRecord

{

    /*

     * Property in Model but not in DB

     */

    public $password2;

    public $rightArray=array();

    //public $rightArray;

    //i tried both

...



controller file:




$model->attributes=$_POST['Manager'];

var_dump($model);



after submit, var_dump()'s output:




  public 'rightArray' => 

    array

      empty




i can get all other property expect this checkBoxList.

if i use:




$model->attributes=$_POST['Manager'];

$model->rightArray=$_POST['Manager']['rightArray'];

var_dump($model);



it worked.

anybody help?

Do you have a validation rule for rightArray ?

Problem solved.

it’s because i haven’t give rightArray a rule.

so after i add

array(‘rightArray’,‘safe’)

in rules.

it worked.

thank 古井好月!

no. i added the rule and it worked.

thank you for you help! ;D