Im trying to pre-validate a form and, when doing it, remove an embeded
form if a field, of this embeded form, is empty.

I tried to use a preValidator, but got a "Fatal error: Call to
undefined method BaseBancoForm::prevalidator()".
I got out of ideas, so, can anyone give me one?

Follow my codes (with last tests included):


=============================== configure method:
      $foto = new BancoImagem();
      $this->embedForm('nova_foto', new BancoImagemForm());
      $this->validatorSchema->setPreValidator(
        new sfValidatorCallback(array('callback' => array($this,
'preValidatorImagem')))
      );
=====================================
  public function preValidatorImagem($validator, $values) {
    if($values['nova_foto']['texto'] == '') {
//      echo "<pre>";
      var_dump($validator);
      unset($this->widgetSchema['nova_foto']);
      unset($this->validatorSchema['nova_foto']);
      unset($values['nova_foto']);
      //die;
    }
    return parent::preValidator($validator, $values);
  }
======================================














--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to