![]() |
Form validation class - creating custom error messages - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Form validation class - creating custom error messages (/showthread.php?tid=14206) |
Form validation class - creating custom error messages - El Forum - 12-22-2008 [eluser]thbt[/eluser] I find that I'm creating a lot of callback functions just so I can have custom error messages. For example: Code: $this->validation->set_message("less_than_limit_1", "The must be less than your spending limit."); The callback functions less_than_limit_1 and less_than_limit_2 are exactly the same: Code: function less_than_limit_1($str,$max) { Obviously I'd like to not have identical callback functions with different names, just so I can have custom error messages. Any way to get around this? Form validation class - creating custom error messages - El Forum - 12-23-2008 [eluser]srisa[/eluser] Is it not possible to do it this way? Code: $this->validation->set_message("less_than_limit_1", "The must be less than your spending limit."); Same callback but different error messages. Form validation class - creating custom error messages - El Forum - 12-23-2008 [eluser]thbt[/eluser] But how would CI know which of those two error messages to display if it fails the less_than_limit_1 validation? I think the second set_message would just override the first one. |