开发者

Yii form validations: comparing password with a field that does not exists in DB

I am new to Yii framework. I want to validate a password field with the repeated value. I use the following rule:

array('password', 'compare', 'compa开发者_如何转开发reAttribute'=>'password2', 'on'=>'register'),

But I receive this error:

Property "Users.password2" is not defined

How can I fix this problem without creating redundant field password2 in the DB?


You can create the property in the model without creating it in the db, so add it like so:

class Users extends CActiveRecord
    {
        public $password2;
            ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜