After talking on the irc room for a while I think I've found either a bug or missing functionality.
First I'll explain the problem and use.
I need to be validate 3 fields to check that one of the three is filled in.
My case:
I have telephone[home], telephone[business], and telephone[cellular]
One of the three of these must be filled in.
What I've tried
- I tried all the required and pre-built validations, non seem to perform this function.
- Next it was on to custom validators
- I created a custom validator called Atleast which is given a number of fields, the field names, and error message and should check to see if atleast one of the fields is validated
- The problem is that the "execute" function is not called unless the field is filled in. I need it to fail validation if all three are not filled in.
- I tried the group functionality
- This seems to be the exact opposite functionality
- If one of the fields is filled in, it gives the other two fields an error message "required"
- If none are filled in I receive no errors.
Here are the hasbins of what I was trying to do:
Note: I'm putting this as a major priority because I believe this is a major functionality that will be needed. Thanks if for any help. Please let me know if the functionality already exists and I'm just missing something.