On 3 oct 2008, 09:58, adrive <miloslav.k...@gmail.com> wrote: > Hello. I am wondering, if there is any kind of group validator. > > I have fields which are not required unless one of them is filled. > > What is the best way to implement this? Can anybody give me some > example of how to validate a group in symfony 1.1? > > Thanks
Hi, (sorry for and old thread) You can validate a group of field (at least one is required) like this : // Check that at least on date is checked $this->validatorSchema->setPostValidator( new sfValidatorOr(array( new sfValidatorSchemaFilter('date_1', new sfValidatorBoolean(array( 'required' => true), array('required' => 'Check at least one date!'))), new sfValidatorSchemaFilter('date_2', new sfValidatorBoolean(array( 'required' => true), array('required' => 'Check at least one date!'))), new sfValidatorSchemaFilter('date_3', new sfValidatorBoolean(array( 'required' => true), array('required' => 'Check at least one date!'))), ))); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---