[eluser]WanWizard[/eluser]
Well, it's a big vague.
The form_validation library checks for the existence of the method by
Code:
$this->CI =& get_instance();
if ( ! method_exists($this->CI, $rule))
{
continue;
}
So it looks for callback methods using the CI superobject pointer.
A big of debugging shows that it points to the controller loaded by the 'front controller'. If you are, like me, in a modular environment where one controller can call other controllers, chances are that callbacks are never going to work, since $this->CI points to the parent controller, not you your module controller. You can test that by adding a "var_dump($this->CI);" in front of the code above, and see which object is dumped. In my case, it's the controller that is loaded after routing. Either way, callbacks in anything other than that controller are not possible.
It would be logical to look for callbacks in the class that called form_validation->run(), but it looks like it doesn't work like that. To be able to do this, you would need to pass $this as a parameter of the run() method, so that the calling method can be accessed.