$this->widgetSchema['password'] = new sfWidgetFormInputPassword(array('label' => 'Password')); $this->widgetSchema['password_confirm'] = new sfWidgetFormInputPassword(array('label' => 'Password confirm')); $this->validatorSchema['password'] = new sfValidatorString(array( 'min_length' => 5 ), array( 'min_length' => 'Password too short (min 5 chars).')); $this->validatorSchema['password_confirm'] = clone $this->validatorSchema['password']; $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_confirm', array(), array('invalid' => 'Passwords do not match.')));Note: In this case password fields are not required.
Thursday, June 24, 2010
Password Confirmation Widget and Validator in Symfony
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment