I need to check that a typed in password is what the user thinks is typed in.
For this I ask for the password to be typed in twice.
I have some existing validation in place but nothing for multiple fields yet.
I wondered how to have the validator check its field against another field.
I could find the syntax for it: 'token' => 'password'
Here is the way to do it:
array(
'name' => 'password',
'required' => true,
'filters' => array(),
'validators' => array(),
),
array(
'name' => 'passwordBis',
'required' => true,
'filters' => array(),
'validators' => array(
array(
'name' => 'identical',
'options' => array(
'token' => 'password',
'messages' => array(
\Zend\Validator\Identical::NOT_SAME => \Application\Util\Translator::translate('The two passwords must be identical')
)
)
)
),
),