With Symfony 1.4's Forms, how can I throw a sfValidatorError in the post validator of an embedded form?
My parent form calls the following:
public function configure(){
$this->embedForm('page', $pageLinkForm);
}
And my embedded form:
public function configure(){
$this->validatorSchema->setPostValidator(new sfValidatorCallback(array(
'callback' => array($this, 'validateLink')
)));
}
public function validateLink($validator, $values) {
if (!empty($values['link']) && !empty($values['outside_link']))
throw new sfValidatorError($validator, 'Only specify either an internal link or an external link, but not both.');
}
The post validator runs validateLink which throws sfValidatorError but it does not show up as a global error and the form isValid(), but it shouldn't be.
Why is the error ignored? How can I make it not ignored?