Thomas Rabaix wrote:
> Hello,
>
> I get that point but this behavior seems to force the user to write
> validator for each specifics validators.
>
> So a form will depends on X externals validators which may not be used
> somewhere else.
>
> My feelings is that too many files or validators add more complexity,
> and will not help to migrate to sf1.1. The sfForm::isValid can be
> overwritten to perform specific validation, and so addError to a field
> ...
You can also use the sfValidatorCallback to avoid creating a validator
if it's a very specific one.
Fabien
>
> Otherwise the method isValid should be set as 'final'
>
> Thomas
>
>
> On Wed, Apr 2, 2008 at 5:25 PM, Nicolas Perriault <[EMAIL PROTECTED]> wrote:
>> On Sat, Mar 29, 2008 at 7:04 PM, Thomas Rabaix <[EMAIL PROTECTED]> wrote:
>>
>>
>>> public function isValid() {
>> > $valid = parent::isValid();
>> >
>> > if($this['password']->getValue() !=
>> $this['password2']->getValue()) {
>> > $valid = false;
>> >
>> > $error = new sfValidatorError(new
>> sfValidatorString(),'invalid');
>> > $this->getErrorSchema()->addError($error,
>> 'password2');
>> > }
>> >
>> > return $valid;
>> > }
>>
>> You should create a custom validator for value comparison purpose (eg.
>> sfValidatorCompare, maybe this one already exist though) and add it to
>> your form validator schema.
>>
>> ++
>>
>> --
>> Nicolas Perriault
>> http://prendreuncafe.com/blog
>> GSM: 06.60.92.08.67
>>
>> >
>>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---