A while back i needed a password confirmation field for my users. I looked and found this neat little snippet. I cant remember who created it originally so i cant give credits to the person but its quite easy to use. Just add this to your library and create a new validator object like this.
This would be in your form where you want to have password confirmation.
Pingback: Zend Framework in Action » Christian Kirkegaard: Password confirmation using Zend Form and Validators
Nice!
It would be more general purpose if you could configure the validator with the names of the two password fields. Maybe passed in the constructor?
Thanks for a great snippet. ;-)
My friend Jeremy Kendall (http://www.jeremykendall.net) and I worked on this.
Pingback: Zend Framework News » Blog Archive » Passwortvalidierung mit Zend_Form und Zend_Validator
Original script is from this tutorial by Andrei Nikolov: http://zfsite.andreinikolov.com/2008/05/part-4-zendform-captcha-password-confirmation-date-selector-field-zendtranslate/
Pingback: Linkpool Nummer 5 | PHP Gangsta - Der PHP Blog
Im getting the Not match always, even if I put same passwords in both of the textbox..
MyValidatePasswordConfirmation
const NOT_MATCH = ‘notMatch’;
protected $messageTemplates = array(self::NOTMATCH => 'Passwords donot match.’);
public function isValid($value, $context = null) { $value = (string) $value; $this->_setValue($value);And my Form $password = new ZendFormElement_Password(‘passwd’,array( ‘required’ => true, ‘label’ => ‘Password’, ‘size’ => 11 ));
$confirmation = new ZendFormElement_Password('confirmation',array( 'required' => true, 'label' => 'Re-Password', 'size' => 11 )); //$confirmation->addValidator('PasswordConfirmation',array('passwd'), true);Could you help me please…
the validator doesnt take any arguments. Just parse the validator to your elements