Welcome Guest, Not a member yet? Register   Sign In
How to validate at least one input?
#1

I have scenarios where a controller can accept multiple inputs, all of which have the 'permit_empty' modifier. However, I require at least one input with a value to perform a useful action. For instance, in a 'cars' controller with search fields like 'color,' 'style,' 'engine type,' etc., I need to validate that I have a value for at least one of these fields, regardless of which one it is. Is there a validation rule that can achieve this? Currently, I'm manually checking if all fields are empty and then throwing an exception, but it would be more elegant if the validator could handle this. Thanks for any advice!
Reply
#2

This question has been answered here.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB