Hi Kiril -
The validators are actually being affected by the 'required'=>false,
you should be able to post a blank field to your form and it will
validate(I just verified this).   The reason when you put any text in
the field both validators are activated is because they are both
activated(as the field is filled in, therefore must pass both
validators), thus it fails.  If you want it so that if a person inputs
some information into the field, but then it doesn't have to pass both
validators, only one, you can do so using the sfValidatorOr.

Daum

On Nov 26, 4:23 pm, "Kiril Angov" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> any reason why this validator is not affected by 'required' => false?
> I want to combine it like so:
>
> $this->setValidator('mpn', new sfValidatorAnd(array(
>     new sfValidatorString(array('min_length' => 5, 'max_length' => 64,
> 'required' => false)),
>     new sfValidatorRegex(array('pattern' =>
> '/^(\s+)?[\w-\#\/]+(\s+)?$/', 'required' => false))
>   ))
> );
>
> Thanks

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to