For the password match, make your own form and do it as follow:
class ChangePassword extends Zend_Dojo_Form
{
public function init()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
// Password
$password = new Zend_Dojo_Form_Element_PasswordTextBox('password');
$password->setLabel('New password)
->addFilters(array(
new Zend_Filter_StripTags(),
new Zend_Filter_StringTrim()
))
->addValidators(array(
new Zend_Validate_StringLength(6, 30),
new Zend_Validate_Alnum()
))
->setMaxLength(30)
->setRequired(true);
// Confirm Password
$password_confirm = new
Zend_Dojo_Form_Element_PasswordTextBox('confirm_password');
$password_confirm->setLabel('Retype new password')
->addFilters(array(
new Zend_Filter_StripTags(),
new Zend_Filter_StringTrim()
))
->addValidators(array(
new Zend_Validate_StringLength(6, 30),
new Zend_Validate_Alnum(),
new
Zend_Validate_Identical($request->getParam('password', ''))
))
->setIgnore(true)
->setMaxLength(30)
->setRequired(true);
// Submit
[...]
Mark Wright a écrit :
I've not seen anything in the docs about this and was wondering if
anybody has come up with a clever way of doing it. Basically, I would
like to use a single validator to validate multiple elements. For
example, in a registration form validating two password fields to make
sure they are identical. Or validating a date spread across three
elements - month, day and year. It would be real convenient to
validate all of this with a simple $form->isValid() instead of having
to do additional validation.
Mark