Validation Class --> error message - 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: Validation Class --> error message (/showthread.php?tid=13706) |
Validation Class --> error message - El Forum - 12-02-2008 [eluser]hsl[/eluser] Hello, On this page I want to give the input fields that are not correct an extra class (.red) instead of a whole message. What is the best way to do this since the validation class doesn't give that option. Thx, hsl Validation Class --> error message - El Forum - 12-02-2008 [eluser]Rey Philip Regis[/eluser] Why do it manually? There are javascript libraries that can do the work for you like dojo. I know they have the feature you need. http://dojotoolkit.org Good day.. Validation Class --> error message - El Forum - 12-02-2008 [eluser]majidmx[/eluser] Hey, As Rey mentioned it's better to do it by Javascript. But if you want to have both working exactly the same you can something like this : Code: <input type='text' value='<?PHP echo set_value('username'); ?>' class='<?PHP echo (isset(form_error('username') && form_error('username') != '')?'normal_css_class_name':'red_css_class_name' ) ?>' /> I have not tried it yet, but it gives you the idea. Take care, MajiD Fatemian Validation Class --> error message - El Forum - 12-02-2008 [eluser]hsl[/eluser] Thx! The javascript suggestion was one I didn't think of. I'm implementing jquery right now. but i'm only going to use it for checking. Validation Class --> error message - El Forum - 12-02-2008 [eluser]majidmx[/eluser] Yeah, it's good to have Javascript validation all the time. But always have the server-side equivalent too, just in case. Passing the javascript validation is not that much hard Take care, MajiD Fatemian |