Welcome Guest, Not a member yet? Register   Sign In
want to invalidate form, add arbitrary message to validation errors based on elaborate logic

I've got a form that has some pretty weird requirements involving multiple inputs. That is to say that my validation requirements require a lot of logic to check form inputs X, Y, and Z against each other in a complicated way.

I have no interest in extending the Form_Validation class specifically for this form. I just want to check the elaborate conditions and, if something is awry, I want to flag the form as invalid and, most importantly, I want to add a validation error message to the list of error messages already displayed.

Is this feasible? Is it complicated? How do I do it? I don't see any methods in Form_Validation class to add error messages to the array.

If you don't want to extend the validation class, then you can use callbacks. It also shows how to set the error message in the docs just below this section, as well as the example.

Theme © iAndrew 2016 - Forum software by © MyBB