![]() |
Still can't get form validation to work - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Still can't get form validation to work (/showthread.php?tid=80288) |
Still can't get form validation to work - Knutsford - 10-12-2021 I am getting Unable to access an error message corresponding to your field name First name.(name_check) This is my code Code: public function name_check($str) This is my rules 'order-info-form' => array( array( 'field' => 'order_first_name', 'label' => 'First name', 'rules' => 'trim|required|name_check' ), array( 'field' => 'order_last_name', 'label' => 'Last name', 'rules' => 'trim|required|name_check' ), I have tried callback_ as well but it doesn't make any difference. I am also getting that when the input is valid Thanks Unable to access an error message corresponding to your field name First name.(name_check) Unable to access an error message corresponding to your field name First name.(name_check) RE: Still can't get form validation to work - Knutsford - 10-13-2021 As I sadi 'rules' => 'trim|required|callback_name_check' didn't work either. That was the thing I tried but I have just spotted that $this->CI->form_validation->set_message('name_check', "The %s may only contain Alpha Numeric Characters and Spaces , /\ . & - ' "); should be $this->form_validation->set_message('name_check', "The %s may only contain Alpha Numeric Characters and Spaces , /\ . & - ' "); but wether that is the problem I don't know until I try it. |