when i am validating a form i want to stop validations when any of the validation fails for the respective input variable for that i had used "cancelOnFail" => true.....But what it actually does is it doesn't check validations for other input variables if the first input variabe fails............................
// Password
$password = new Password('password', [
"maxlength" => 8,
]);
$password->setLabel('Password');
$password->setFilters(array('striptags', 'string'));
$password->setAttribute('class', 'form-control');
$password->addValidators(array(
new PresenceOf(array(
'message' => 'Password is required',
"cancelOnFail" => true,
)),
new StringLength(array(
'min' => 8,
'messageMinimum' => 'Minimum length of password should be atleast 8',
"cancelOnFail" => true,
)),
));
$this->add($password);
// repeatPassword
$repeatpassword = new Password('repeatPassword', [
"maxlength" => 8,
]);
$repeatpassword->setAttribute('class', 'form-control');
$repeatpassword->setFilters(array('striptags', 'string'));
$repeatpassword->setLabel('Repeat Password');
$repeatpassword->addValidators(array(
new PresenceOf(array(
'message' => 'Please Re-Enter your password',
"cancelOnFail" => true,
)),
new Confirmation(array(
'message' => 'Passwords doesn\'t match',
'with' => 'password',
"cancelOnFail" => true,
)),
));
$this->add($repeatpassword);
so when i try submit this form i should get error messages for password=Password is required and for repeatpassword Please Re-Enter your password.........i e it should not check the other validations of each input variable............. when but i use "cancelOnFail" => true, i just get validation msg for password and it stops there itself.....how can i validate the whole variables and stop validations for each variable when fails....?
Please help..!!!!!!!!!!!