problem with modle roles for cactionform

hi got this roles :


public function rules() {

        // NOTE: you should only define rules for those attributes that

        // will receive user inputs.

        return array(

            array('name', 'required'),

            array('name', 'filter', 'filter' => 'trim'),

            array('name', 'length', 'max' => 100, 'encoding' => 'UTF-8'),

            array('description', 'encoding' => 'UTF-8'),

            array('achiv_traget_count', 'required'),

            array('achiv_traget_count', 'unique',

                'criteria' => array(

                    'condition' => 'achiv_traget_count= :count',

                    'params' => array(':count' => $this->achiv_traget_count))),

            array('achiv_traget_count', 'numerical', 'length', 'max' => 5),

            array('achiv_added_value', 'required'),

            array('achiv_added_value', 'numerical', 'length', 'max' => 5),

            array('active', 'boolean', 'falseValue' => 0, 'trueValue' => 1),

            // When we replace, it is ok to set the ID explicitly

            array('id', 'numerical', 'integerOnly' => true),

            array('id, active, achiv_added_value, achiv_traget_count , name', 'safe', 'on' => 'search'),

        );

    }

its tell me that the Validator is in currect

how do i fix this thanks for the helpers

What kind of error are you getting? On which field or validator is the error occurring?

Hi swolberg,

The erroneous part is this:




 array('description', 'encoding' => 'UTF-8'),



The second parameter should always be the validator name. Replace your code with this:




 array('description', 'length','encoding' => 'UTF-8'),