why in yii1.7 ,my compare validator , et.
array(‘password’, ‘compare’, ‘compareAttribute’=>‘verifyPassword’, ‘on’=>‘add’, ‘message’=>Yii::t(‘user’, ‘twice password not the same’)),
when it’s has correct ,but the error info don’t get out
why in yii1.7 ,my compare validator , et.
array(‘password’, ‘compare’, ‘compareAttribute’=>‘verifyPassword’, ‘on’=>‘add’, ‘message’=>Yii::t(‘user’, ‘twice password not the same’)),
when it’s has correct ,but the error info don’t get out
Hi,
I just think I ran into the same problem on Yii 1.1.8.
I have some own test code right before the save() call that fails:
if ($current_user->password === $current_user->password_repeat)
echo "should work";
else
echo "should fail";
if (strcmp($current_user->password, $current_user->password_repeat) === 0)
echo "should work2";
else
echo "should fail2";
if (strcasecmp($current_user->password, $current_user->password_repeat) === 0)
echo "should work3";
else
echo "should fail3";
if (!$current_user->save()) {
echo '<div class="errorSummary">';
echo CHtml::errorSummary($current_user);
echo '<div>';
}
and a validation rule that says:
// for user options page where password is changeable
array('password', 'compare', 'compareValue' => 'password_repeat', 'on' => 'optionsEdit', 'message' => Yii::t('app', 'Passwörter stimmen nicht überein')),
No matter what Yii says, the attributes compared here are exactly the same but the save Method fails on the compare validation rule!
I see "should work 1/2/3" in the cases it should work and "should fail 1/2/3" in the cases it should fail to validate…
The scenario is set right, there are no before- and onBeforeSave methods or something like that.
It should work imo.
Have you been able to solve this?
greez