What is a good approach to write a password validator that validates two inputs (must be eqeal) and how would you integrate that into a zf2 form.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There is an "Identical" validator that check two fields to be equal, it can be used in the following way in form constructor:
$this->add(array(
'name' => 'password', // add first password field
/* ... other params ... */
));
$this->add(array(
'name' => 'passwordCheck', // add second password field
/* ... other params ... */
'validators' => array(
array(
'name' => 'Identical',
'options' => array(
'token' => 'password', // name of first password field
),
),
),
));