yii2重新键入密码不起作用

时间:2015-12-22 10:35:52

标签: yii2-validation

我尝试在注册表单中实现重新输入密码字段。但不幸的是我没有为我工作。请帮我。

 public $repeatpassword;    
 public function rules()  {    

     [['Fname','Lname','username','email', 'password'], 'required'],
        [['password'],'string', 'min' => 3],
        [['repeatpassword'],'required'],
        ['repeatpassword', 'compare','compareAttribute'=>'password', 
                 'message'=>"Passwords don't match", 'on' => 'create']    
 }

1 个答案:

答案 0 :(得分:1)

试试这个:

['repeatpassword', 'compare', 'compareAttribute' => 'password',
'message'=>"Passwords don't match"]