I have created a form to add a user to a database and make user available for login.
Now I have two password fields (the second is for validation of the first). How can I add a validator for this kind of validation to zend_form?
This is my code for the two password fields:
$password = new Zend_Form_Element_Password('password', array(
'validators'=> array(
'Alnum',
array('StringLength', array(6,20))
),
'filters' => array('StringTrim'),
'label' => 'Wachtwoord:'
));
$password->addFilter(new Ivo_Filters_Sha1Filter());
$password2 = new Zend_Form_Element_Password('password', array(
'validators'=> array(
'Alnum',
array('StringLength', array(6,20))
),
'filters' => array('StringTrim'),
'required' => true,
'label' => 'Wachtwoord:'
));
$password2->addFilter(new Ivo_Filters_Sha1Filter());
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…