Welcome Guest, Not a member yet? Register   Sign In
Passing extra data to callback.
#3

[eluser]sckarlin[/eluser]
I upgraded some code to CI 2.0.0 and found that parameters to callbacks didn't work the way they used to.

I found that by commenting out line 494 of Form_validation.php, my $rules weren't clobbered by the preg_match in line 492. I'm still in the early stages of experimenting with this so I don't know if this breaks other behavior.

Code:
// If the field is blank, but NOT required, no further tests are necessary
$callback = FALSE;
if ( ! in_array('required', $rules) AND is_null($postdata))
{
    // Before we bail out, does the rule contain a callback?
    if (preg_match("/(callback_\w+)/", implode(' ', $rules), $match))
    {
        $callback = TRUE;
        //$rules = (array('1' => $match[1]));  // why??
    }
    else
    {
        return;
    }
}


Messages In This Thread
Passing extra data to callback. - by El Forum - 02-03-2011, 06:45 AM
Passing extra data to callback. - by El Forum - 02-08-2011, 07:35 PM
Passing extra data to callback. - by El Forum - 02-10-2011, 07:51 AM
Passing extra data to callback. - by El Forum - 02-10-2011, 01:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB