Custom errors in Form Validation (basic) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Custom errors in Form Validation (basic) (/showthread.php?tid=16610) |
Custom errors in Form Validation (basic) - El Forum - 03-11-2009 [eluser]Stu Green[/eluser] Hey all Just thought I'd share some code that I've been working on. This is a really simple solution to a problem that I've had with the new Form Validation class. You can set custom error messages with it. Code below, also in my blog post: http://www.haloweb.co.uk/blog/2009/03/codeigniter-custom-errors-using-the-form-validation-class/ If anyone wants to build on it, feel free. Thanks Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Custom errors in Form Validation (basic) - El Forum - 03-12-2009 [eluser]pistolPete[/eluser] Since MY_Form_validation is just a subclass of Form_validation, you could use: Code: function set_error($error = '') |