Hi,
I have a form validation issue.
here's the code
When I used CI 3.0.6 , it could run "required", "min_length[8]" and "callback_access" function together.
But it won't work together when I update to CI 3.1.0.
If I remove "callback_access" function (as bellow), then "required" and "min_length[8]" can be work correctly.
the callback function:
How do I fix this?
Thanks!!
I have a form validation issue.
here's the code
Code:
$this->form_validation->set_rules('pass','password','required|min_length[8]|callback_access');When I used CI 3.0.6 , it could run "required", "min_length[8]" and "callback_access" function together.
But it won't work together when I update to CI 3.1.0.
If I remove "callback_access" function (as bellow), then "required" and "min_length[8]" can be work correctly.
Code:
$this->form_validation->set_rules('pass','password','required|min_length[8]');Code:
public function access(){
$acc = $this->input->post('acc', TRUE);
$pass = md5($this->input->post('pass', TRUE));
$user = $this->login->select_user($acc); //model
if(!empty($user)){
if($user->db_password == $pass){
//save sessions
return TRUE;
}else{
$this->form_validation->set_message('access',"account or password was incorrect");
return FALSE;
}
}else{
$this->form_validation->set_message('access',"account or password was incorrect");
return FALSE;
}
}Thanks!!