$this->setValidators(array(
...,
'enabled' => new sfValidatorBoolean(),
...,
));
Showing posts with label widget. Show all posts
Showing posts with label widget. Show all posts
Tuesday, March 20, 2012
Doctrine Not Save Boolean Value to Database in Symfony
If you create a boolean field in the database and symfony renders it as a checkbox ( sfWidgetFormInputCheckbox ) in the form... AND DOCTRINE DOES NOT SAVE THE VALUE TO THE DATABASE, you have to a put the boolean validator on it and doctrine will save the value. That's the magic.
Thursday, June 24, 2010
Password Confirmation Widget and Validator in Symfony
$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.
Subscribe to:
Posts (Atom)