How to verify password field in zend form?

前端 未结 7 1314
旧巷少年郎
旧巷少年郎 2021-02-04 09:39

In my form, I\'m trying to verify that the user fills in the same value both times (to make sure they didn\'t make a mistake). I think that\'s what Zend_Validate_Identical

7条回答
  •  攒了一身酷
    2021-02-04 09:52

    I can't test it at the moment, but I think this might work:

    $this->addElement('password', 'password', array(
        'label'      => 'Password:',
        'required'   => true
    ));
    $this->addElement('password', 'verifypassword', array(
        'label'      => 'Verify Password:',
        'required'   => true,
        'validators' => array(
            array('identical', true, array('password'))
        )
    ));
    

提交回复
热议问题