Welcome Guest, Not a member yet? Register   Sign In
Callback function are not working...
#1

[eluser]boltsabre[/eluser]
Hi everyone,

Can anyone confirm (or deny) if there is a bug with callback validation functions.

I recently upgraded my project from an older version of CI to V2.1.3, and was testing an old part of the site before launching it to my test server, however, my callback functions are not working.

I've even tried with the exact example from the user guide and that's not working either.

1. Form validation library IS loaded (required, and other CI validation functions are working).
2. Functions in libraries/MY_Form_validation ARE working as expected.
3. It's just one callback function I have that isn't working. Here's the code:

Code:
function edit_job(){
   ...
   $this->form_validation->set_rules('phone', 'Phone Number', 'trim|min_length[6]|max_length[25]|phone_check|callback_phone_and_email_required');
   ....
   //phone check is a function inside MY_Form_Validation, and it works!!!

}// end of function

function phone_and_email_required($str){
   print_r('here');
   die();
  // doesn't work.. no printing, no dying
}

Having a look at the core form valiation library, I think I've isolated where there problem is, but have no idea why, or how, to fix it:
Code:
//System/libraries/Form_validation.php, line 584

// Call the function that corresponds to the rule
if ($callback === TRUE)
{
       var_dump($rule), //works, prints 'phone_and_email_required'
       var_dump(method_exists($this->CI, $rule));
       //prints bool(false), but it should be true!!!

        if ( ! method_exists($this->CI, $rule))
{
  continue;
}
      var_dump('still here'); // nothing, because the above check failed, executing the 'continue' statement.


If anyone has any idea on why my callback function (even the exact copy of the one from the user manual) is failing, I'd be extremely grateful, this is driving me nuts and I'm desperately trying to get my site onto my test server within the next two weeks!!!

Don't know if it makes any difference, but the controller is extending MY_Controller, which in turn is extending MX_Controller for hmvc...


Messages In This Thread
Callback function are not working... - by El Forum - 01-31-2013, 12:24 PM
Callback function are not working... - by El Forum - 02-01-2013, 02:33 AM
Callback function are not working... - by El Forum - 02-01-2013, 04:10 AM
Callback function are not working... - by El Forum - 02-01-2013, 04:41 AM
Callback function are not working... - by El Forum - 02-01-2013, 04:59 AM
Callback function are not working... - by El Forum - 02-02-2013, 04:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB