Try something like this if the validator doesn't work http://snipt.net/Tram/validation-for-a-date-range-with-to-date-field-not-mandatory/
On 29 dub, 15:12, John <[email protected]> wrote: > Hi, > > I'm trying to validate two dates : the begin_date has to be before the > end_date or else an error is thrown. > > I found the sfValidatorSchemaTimeInterval validator with the plugin > sfFormExtraPlugin, it seems to do what I want but I can't get it to > work. > > Here's what I have in lib/form/doctrine/ModuleForm.php : > > $this->validatorSchema['end_date'] = new > sfValidatorSchemaTimeInterval($this['begin_date'], > $this['end_date'],array('min_duration' => 1000)); > > When I submit the form with the end_date sooner than the begin_date, > there isn't any error, the form passes. But the end_date field is now > empty... > > I saw in the class that there's an error code "start_not_prior", wich > is exactly what I'm looking for. But I don't know how to throw it ! > > Since there's no example on the web, I thought maybe one of you could > help me :-) > > Thanks in advance ! > > -- > 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 > athttp://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
