1

模型对象为

UserChangePassword Object
(
    [oldPassword] => 
    [password] => 
    [verifyPassword] => 
    [_errors:CModel:private] => Array
        (
        )

    [_validators:CModel:private] => 
    [_scenario:CModel:private] => change
    [_e:CComponent:private] => 
    [_m:CComponent:private] => 
)

模型规则是

array('oldPassword, password, verifyPassword', 'required','on' => 'change'),
            array('oldPassword, password, verifyPassword', 'length', 'max'=>128, 'min' => 4,'on' => 'change','message' => Yii::t('recovery',"Incorrect password (minimal length 4 symbols).")),
            array('verifyPassword', 'compare', 'compareAttribute'=>'password','on' => 'change','message' => Yii::t('recovery',"Retype Password is incorrect.")),
            array('oldPassword', 'verifyOldPassword','on' => 'change'),

控制器创建模型为

$passwordForm = new UserChangePassword('change');
$this->renderPartial('_password', array('form' => $passwordForm));

问题

请帮我 ?

在此处输入图像描述

4

1 回答 1

0

rules方法必须返回验证规则数组。就像下面这样:

public function rules()
{
    return array(
        // validation rules go here
    );
}

如果没有(仅声明数组并且return缺少关键字) - 这可能会导致问题。

于 2013-05-03T12:03:02.400 回答