Welcome Guest, Not a member yet? Register   Sign In
Validation - Custom callback not behaving as expected?
#2

[eluser]wiredesignz[/eluser]
I usually set the error message before the test.

Code:
function ratings_check() {
    $this->validation->set_message('ratings_check','You must specify at least one rating (US or Canada).');
    return (bool)(!$this->input->post('us_rating') && !$this->input->post('cdn_rating')) ;
}

Of course if the numeric check fails first the callback won't be run

EDIT: Validation is not carried out on an empty input unless the "required" switch is used.

You may want to add the callback test to the submit button or some other field instead.


Messages In This Thread
Validation - Custom callback not behaving as expected? - by El Forum - 02-04-2008, 07:43 PM
Validation - Custom callback not behaving as expected? - by El Forum - 02-04-2008, 08:33 PM
Validation - Custom callback not behaving as expected? - by El Forum - 02-04-2008, 08:44 PM
Validation - Custom callback not behaving as expected? - by El Forum - 02-24-2008, 12:21 PM
Validation - Custom callback not behaving as expected? - by El Forum - 04-01-2008, 09:08 AM
Validation - Custom callback not behaving as expected? - by El Forum - 04-01-2008, 09:33 AM
Validation - Custom callback not behaving as expected? - by El Forum - 04-01-2008, 08:01 PM
Validation - Custom callback not behaving as expected? - by El Forum - 03-21-2010, 07:42 PM
Validation - Custom callback not behaving as expected? - by El Forum - 03-22-2010, 04:58 PM
Validation - Custom callback not behaving as expected? - by El Forum - 03-22-2010, 06:09 PM
Validation - Custom callback not behaving as expected? - by El Forum - 03-22-2010, 11:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB