Welcome Guest, Not a member yet? Register   Sign In
Form Validation, Errors
#1

[eluser]oddman[/eluser]
Hey all,

Just a quick question - how exactly does the CI form_validation handle multiple validation methods and its errors? Does it stop validating as soon as a particular field has returned false, or does it execute all validation methods then sets all errors messages? The reason I ask (unable to test atm, at work Tongue) is that I am currently doing this:

Code:
$this->form_validation->set_rule('email', 'required|callback__email_unique');

Basically, I only ever want 1 error per field, and I do not believe it should be executing both, especially if the requirement check fails.

Does CI execute all validation methods, or does it execute each in turn until all validations are successful or it encounters a false return?


Cheers!
#2

[eluser]Thorpe Obazee[/eluser]
I believe it executes the first one then stops. At least that's how I see it. (Should check it later).
#3

[eluser]Mike Ryan[/eluser]
bargainph is right - it will only return one error, as it will stop processing rules for that field as soon as one is 'broken'.




Theme © iAndrew 2016 - Forum software by © MyBB