The thing is that it needs to pass both validators but also for those  
validators to respect the not required option. This is the way php  
checks the && operator, I mean one side of the && does not care about  
the other side. They also do not care if they are used with && or  
simply with an if statement.

Sent from my iPhone

On Nov 27, 2008, at 6:27, Daum <[EMAIL PROTECTED]> wrote:

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