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

[eluser]NBrepresent[/eluser]
Hi, I might just be doing this wrong... but I have a situation where one of two fields must be set, so neither are required, but it is required that at least one is set.

Here's the custom callback I'm using:

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

Here's how I set the rules:
Code:
$rules['us_rating']    =    "numeric|callback_ratings_check";
$rules['cdn_rating']    =    "numeric|callback_ratings_check";

Submitting the form with neither of them set is NOT returning false and triggering the error (as it should).

Can anyone offer any advice on this?


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