Welcome Guest, Not a member yet? Register   Sign In
Can not Define Callback function in Codeigniter
#1

[eluser]Unknown[/eluser]
Hi, i am using CI 2.1.4
I want use callback in my model, this is code
My callback function
Code:
public function check_state_license_number($license_number){
           if ( preg_match('/^([0-9]{10})$/', $license_number)||preg_match('/^([0-9]{11})$/', $license_number)) {
               return true;
           }else return false;
  }

my config
Code:
$conf = array(
                    array(
                        'field' => 'state_license_number',
                        'label' => 'State License Number',
                        'rules' =>'required|callback_check_state_license_number'
                    )
               );
$this->form_validation->set_rules($conf);

I am sure set validate rules before call run_validation, but it can't validate.
Is CI allow define callback in Model ?


Messages In This Thread
Can not Define Callback function in Codeigniter - by El Forum - 09-20-2013, 02:58 AM
Can not Define Callback function in Codeigniter - by El Forum - 09-20-2013, 04:02 AM
Can not Define Callback function in Codeigniter - by El Forum - 09-20-2013, 08:46 AM
Can not Define Callback function in Codeigniter - by El Forum - 06-26-2014, 09:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB