Problem iwith validation callback - 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: Problem iwith validation callback (/showthread.php?tid=65095) |
Problem iwith validation callback - nunenthal - 04-28-2016 Hello, I write this bellow, my validation rules arre working, but the callback function not. I'm new in codeigniter and maybe a little stupid, please help. PHP Code: public function add_annonce_do() RE: Problem iwith validation callback - InsiteFX - 04-28-2016 Try this: PHP Code: if (($annee <= '1870') || ($annee >= $current_year)) RE: Problem iwith validation callback - nunenthal - 04-28-2016 (04-28-2016, 11:02 AM)InsiteFX Wrote: Try this: The problem is not that the callback function is not working, the problem is that it seem that the callback function is not called. Even if I write this, the validation is TRUE PHP Code: public function annee_check($annee) RE: Problem iwith validation callback - nunenthal - 04-29-2016 Solved, In fact this is not possible : $this->form_validation->set_rules('annee', 'Année', 'required|callback_annee_check'); You must write this $this->form_validation->set_rules('annee', 'Année', 'callback_annee_check'); And create the error message manually in the callback function in case of empty field. |