Custom Validation Messages not shown - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: Custom Validation Messages not shown (/showthread.php?tid=91387) |
Custom Validation Messages not shown - dipi66 - 08-02-2024 Hello everyone, I'm trying to validate a form with a custom error message. The message displayed is always the default, in English. Here is my code: PHP Code: $validation = \Config\Services::validation(); For testing I print the getRules(): PHP Code: Array ( [sonde_nom] => Array ( [label] => Nom [rules] => Array ( [0] => required [1] => min_length[3] ) ) ) What did I miss? Thank you in advance for your help RE: Custom Validation Messages not shown - kenjis - 08-02-2024 See https://codeigniter.com/user_guide/incoming/controllers.html#this-validate But as the Important note says, we recommend that you use the validateData() method instead. https://codeigniter.com/user_guide/incoming/controllers.html#this-validatedata RE: Custom Validation Messages not shown - kenjis - 08-02-2024 Try: PHP Code: $rules = [ RE: Custom Validation Messages not shown - Bosborne - 08-03-2024 (08-02-2024, 04:51 PM)kenjis Wrote: See https://codeigniter.com/user_guide/incoming/controllers.html#this-validate I see that was introduces way back in 4.2.0, before I started with CI. I somehow missed that. Now I need to update my projects, most of which are nearing deployment. RE: Custom Validation Messages not shown - dipi66 - 08-04-2024 Perfect ! Thanks you |