Ok, it was easier than what I thought:

$this->validatorSchema['CodFiscale'] = new sfValidatorAnd(array(new
sfValidatorString(array('min_length' => 16, 'max_length' => 16), array
('min_length' => 'Il Codice Fiscale è troppo corto, deve essere di 16
caratteri', 'max_length' => 'Il Codice Fiscale è troppo lungo, deve
essere di 16 caratteri'))));

$this->validatorSchema['CodFiscale']->setOption('required', false);



On 19 Ago, 20:31, Stefano <stef...@sancese.com> wrote:
> It looks like if I define a validatorSchema for a field, the field is
> Required.
>
> Since I need to validate a field, but only if it is not empty (I wrote
> a custom validator to handle the empty field case), I get a Required
> error I can not get rid of.
>
> Any suggestion?
>
> TIA
>
> Stefano
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to