Thanks

works fine!



Augusto Morais

2010/3/16 Lea Hänsenberger <[email protected]>

> Hi,
> use an sfValidatorAnd to combine the two post validators:
>
> $this->mergePostValidator(new sfValidatorAnd(array(
>        new sfValidatorCallback(array('callback' => array($this,
> 'checkSOCIALSECURITY'))),
>         new sfValidatorSchemaCompare('senha',
> sfValidatorSchemaCompare::EQUAL, 'password_again',
>          array('throw_global_error' => true),
>          array('invalid' => 'The passwords need be equal')
>    )
> )));
>
> Cheers,
> Lea
>
> On Mar 16, 2010, at 14:53 , Augusto Flavio wrote:
>
> > Hi,
> >
> >
> >
> > i have a form that i need to check whether 2 strings is equal and i'm
> using a setPostvalidator to check duplicated fields in my DB. The 2 codes
> works fine. But only one for time. not the both together.
> >
> >
> > here is the code:
> >
> > class UsersForm extends BaseUsersForm {
> >
> > (...)
> >
> >     public function configure()
> >
> >     (...)
> >
> >     $this->validatorSchema['password_again'] = clone
> $this->validatorSchema['password'];
> >     $this->mergePostValidator(new sfValidatorSchemaCompare('senha',
> sfValidatorSchemaCompare::EQUAL, 'password_again',
> >         array('throw_global_error' => true),
> >         array('invalid' => 'The passwords need be equal')
> >       )
> >     );
> >
> >
> >     $this->validatorSchema->setPostValidator(
> >       new sfValidatorCallback(array('callback' => array($this,
> 'checkSOCIALSECURITY')))
> >     );
> >
> > }
> >
> >     public function checkSOCIALSECURITY($validator, $values)
> >     {
> >         if
> (UsersPeer::checkSOCIALSECURITYDuplicated($values['socialsecurity'])) {
> >           throw new sfValidatorError($validator, 'Your social security
> was already registered.');
> >     }
> > }
> > }
> >
> >
> > What can i do to the both validators works fine?
> >
> >
> >
> > thanks
> >
> >
> >
> >
> > Augusto Morais
> >
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
> >
> > 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]<symfony-users%[email protected]>
> > For more options, visit this group at
> > http://groups.google.com/group/symfony-users?hl=en
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> 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]<symfony-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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