01-09-2015, 04:59 AM
I am creating validation rules in model.
Goal is that all data manipulation functionality should be in model.
Normal validate without callback working perfect. But with callback function it is not working.
This functions are in my User_model.php
Goal is that all data manipulation functionality should be in model.
Normal validate without callback working perfect. But with callback function it is not working.
This functions are in my User_model.php
Code:
public function rules($action=""){
$this->form_validation->set_rules('trigger_name', "trriger", 'trim|required');
$this->form_validation->set_rules('from_user', "from", 'trim|required');
$this->form_validation->set_rules('to_user', "to", 'trim|required');
$this->form_validation->set_rules('email', "email",'callback_validate_user');
}
public function validate_user($str){
$this->form_validation->set_message('email', 'Invalid user ');
return false;
}
public function save(){
$this->rules();
if ($this->form_validation->run()){
// save query
}
}