[eluser]jleequeen[/eluser]
I'm sure this is a problem that has been dealt with before, but I wanted to get some ideas on how to implement it with the CI Validation class.
I know the Validation class cannot possibly do everything that everyone would want, and for what it does, it serves it's purpose well. But, what I'm wondering is how to extend the validation class so that you can put other criteria in, in order for a form to validate. Let me give an example.
Let's say I have a group of fields that don't all individually need to be validated. I just basically want to make sure, of the group of fields, at least one was filled out. And let's say I also want to know, across the fields, that they add up to say 100%. So basically I have say 5 fields, and I just want to make sure at least one was filled out, and that whether one or all 5 were filled out, that the total equals 100%.
With the current validation class, I'm not sure this can be accomplished. I know you can do validation for each field, and if you want to do something custom for a field you can do a callback, but that's not the kind of validation I need. Obviously checking that all fields add up to 100% has nothing to do with an individual field rule. Hopefully you understand what I'm saying here.
Does anyone have any suggestions when it comes to custom validation and how to implement it into the validation class so that you can still choose use the...
Code:
if ($this->validation->run() == FALSE) {
}
to check for all validation rules?