$this->setValidators(array(
...,
'enabled' => new sfValidatorBoolean(),
...,
));
Showing posts with label validator. Show all posts
Showing posts with label validator. 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, October 28, 2010
Remove PostValidator in Symfony
Remove post validator that is set in a base form:
$this->validatorSchema->setPostValidator(new sfValidatorPass());
Labels:
postvalidator,
symfony,
validator
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.
Monday, June 21, 2010
Symfony String Validator
$this->validatorSchema['subject'] = new sfValidatorString(array( 'required' => true, 'max_length' => 255 ), array( 'required' => 'Required field.', 'max_length' => 'Too long, maximum 255 characters.' ));
Subscribe to:
Posts (Atom)