On a simple ActiveForm to change user password the attributes new_password and repeat_password not are validated also if both have the same value. In the javascript validation a log on $form.data('yiiActiveForm').attributes show only 2 attribute instead 3 (email, new_password and repeat_password), the attribute lost is new_password and the validation result return always false.
Scenario configuration:
self::SCENARIO_PROFILE => ['email', 'new_password', 'repeat_password']
Validations roles:
['new_password', 'safe'],
['repeat_password', 'required',
'when' => function($model){
return !empty($model->new_password);
},
'whenClient' => "function(attribute, value){
return $('#user-new_password').val() != '';
}"
],
['repeat_password', 'compare', 'compareAttribute' => 'new_password', 'operator' => '=='],
| Q | A
| ---------------- | ---
| Yii version | 2.0.15.1
| PHP version | 7.2.7
| Operating system | Ubuntu 18.04
No more news about this bug? Still not working.
Thanks for the support!
Nope.
This bug fixed PR #16523. Please close this issue
Most helpful comment
This bug fixed PR #16523. Please close this issue