![]() |
Custom error message by field name - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Custom error message by field name (/showthread.php?tid=3800) |
Custom error message by field name - El Forum - 10-22-2007 [eluser]mkhairul[/eluser] Hi all! I'm quite new to CI. I'd like to know if there's a better way to create a custom error message for a specific field for a certain rule? For example, I have 3 field test1, test2, test3. I want required rule error message for test1 to be woot, test2 to be wargh and test3 to be something else. I did a few modifications the Validation library(copied it to the application/library folder and modified it there). Code: function set_custom_message($lang, $field_name, $val = '') And modified the run function a little bit Code: // Did the rule test negatively? If so, grab the error. |