Identical Validator does not work
I wanted to use the Phalcon\Validation\Validator\Identical Validator in order to Check if a Checkbox was clicked in my Formular.
But no matter what i try the validation always fails. I'm currently using Phalcon v2.0.3
$validator = new \Phalcon\Validation();
$validator->add('terms', new \Phalcon\Validation\Validator\Identical(array(
'accepted' => 'yes',
'message' => 'You need to accept the Terms of Agree'
)));
$post = array('terms' => 'yes');
$messages = $validator->validate($post);
if ($messages->count()) {
echo "Validation failed!";
}
The Validation above always fail even if the Value is identical.
@alphanyx You must use parameter value instead of accepted
So the Documentation is wrong?
@alphanyx yes!
@phalcon Where better to fix in the documents or in the code?
In the code please: https://github.com/phalcon/cphalcon/blob/2.0.x/phalcon/validation/validator/identical.zep
Fixed in the 2.0.x branch
For everybody who use the CSFR vokuro example please make sure you change value to accepted after upgrading to 2.0.4. Or all CSFR check will fail. (Took me some time to find out what happend ;))