Ruben,

I think the best way will be to create a validator schema and set is as a
post validator. Then you have access to all of the fields and can validate
them as necessary.

I did this once when I had two radio buttons, but one could not be selected
if a certain field was empty.

I have posted that validator as an example: http://pastebin.com/mf4b40ef

I hope that helps.

Brandon

> -----Original Message-----
> From: symfony-users@googlegroups.com [mailto:symfony-
> us...@googlegroups.com] On Behalf Of Ruben
> Sent: Friday, January 02, 2009 11:25 AM
> To: symfony-users@googlegroups.com
> Subject: [symfony-users] Best way to do conditional form validation
> 
> Hi all,
> 
> I found the symfony form validation framework quite useful so far.
> Though I've yet to find a way to do proper
> conditional form validation based on the submitted values of other
> forms.
> 
> Use case:
> A form with multiple input fields and a select box A (yes|no). If A is
> yes some fields within the forms must be validated
> as required, if A is no they are optional.
> 
> I'm sure this has been done before, could you please provide me with an
> example on how to accomplish this specific use case?
> 
> I very much appreciate your response.
> 
> Kind regards,
> Ruben
> 
> 
> 
> > 




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

Reply via email to