What i need to do is customize my default userForm by adding a 'passwordagain' field and set the value to the new field equal to the 'password' field. My code:
class UserForm extends BaseUserForm
{
public function configure()
{
$this->widgetSchema['password'] = new sfWidgetFormInputPassword();
$this->widgetSchema['passwordagain'] = new sfWidgetFormInputPassword();
$this->validatorSchema['password'] = new sfValidatorString();
$this->validatorSchema['passwordagain'] = new sfValidatorString();
$this->getValidatorSchema()->setPostValidator(
new sfValidatorSchemaCompare(
'password',
sfValidatorSchemaCompare::EQUAL,
'passwordagain',
array(),
array('invalid' => 'Passwords don\'t match')
));
$this->setDefault('passwordagain', $this->getObject()->getPassword());
$this->useFields(array('username', 'password', 'passwordagain'));
} }
The setDefault method there doesn't seem to work. Perhaps it works only for new users, but that's not what i am looking for here.
Thanks, Radu.
P.S.: btw... i use symfony 1.4 with propel