我尝试在注册表单中实现重新输入密码字段。但不幸的是我没有为我工作。请帮我。
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']
}
答案 0 :(得分:1)
试试这个:
['repeatpassword', 'compare', 'compareAttribute' => 'password',
'message'=>"Passwords don't match"]