Hello,
I am trying to add an error to a field in the form::isValid method
public function isValid() {
$valid = parent::isValid();
if($this['password']->getValue() !=
$this['password2']->getValue()) {
$valid = false;
$error = new sfValidatorError(new
sfValidatorString(),'invalid');
$this->getErrorSchema()->addError($error, 'password2');
}
return $valid;
}
This code doesn't work, unless I added : $this['password2']->error =
$error; and changed the sfFormField::$error property to public
For now the error field is protected and there is no way to add error
to sfFormField class
So my guesses :
1. I am not doing the right way
2. setter methods are missing form the sfFormField class
I have look to the code and sfForm::offsetGet create the sfFormField
class with an error provided by the sfValidatorErrorSchema. Which is
great, but, once this is created, there is no way to change the error
value.
any comments ?
Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---