Welcome Guest, Not a member yet? Register   Sign In
Split the form_validation to 2 parts
#3

[eluser]boltsabre[/eluser]
Validation rules execute in the order that they are defined, so you could just put your callback function at the very end, and then it wont fire until all other rules have passed:

Or, you can do something along these lines:
Code:
if ($this->form_validation->run() == FALSE){
    //validation rules have failed, load view with validation errors
     $this->load->view('some_view', $data);
}else{
     //successfully passed validation, run callback
    $data['check'] = some_callback_function($input_of_whatever);
    if($check !== true){
         //load view again, $data['check'] contains the validation failed message
         $this->load->view('some_view', $data);
   }else{
      //callback worked... continue code, and redirect() to wherever the user should go.
   }
}


Messages In This Thread
Split the form_validation to 2 parts - by El Forum - 01-29-2013, 08:04 AM
Split the form_validation to 2 parts - by El Forum - 01-29-2013, 08:09 AM
Split the form_validation to 2 parts - by El Forum - 01-29-2013, 08:18 AM
Split the form_validation to 2 parts - by El Forum - 01-29-2013, 08:39 AM
Split the form_validation to 2 parts - by El Forum - 01-29-2013, 09:15 AM
Split the form_validation to 2 parts - by El Forum - 01-29-2013, 04:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB