[eluser]newtonianb[/eluser]
How can I call a library function in a form validation callback?
Like
$this->form_validation->set_rules('my_var', '"Variable Input"', 'required|alpha|callback__$this->myLib->checkMyVar');
[eluser]cahva[/eluser]
Not possible as CI checks for the method in $this->CI object. But you could just create the callback in that controller where you use your library:
Code:
function check_my_var()
{
return $this->my_lib->check_my_var();
}
[eluser]newtonianb[/eluser]
Thanks cahva, that's what i'm doing now but I was trying to clean things up since I need to call this function in most of my controllers I wanted to remove that extra local function proxy
[eluser]newtonianb[/eluser]
FYI
I found a great way to do this. I extended form_validation and this extended form validation the calls my library functions.