How to change a color of the inputbox on form_error validation? - 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: How to change a color of the inputbox on form_error validation? (/showthread.php?tid=51408) |
How to change a color of the inputbox on form_error validation? - El Forum - 05-02-2012 [eluser]term25[/eluser] I would like to change a class of the input element (e.g. in css style sheet then I can add border 1px solid red for input element etc.), when there is a validation error. How to achieve this? I have not found any solution for CodeIgniter yet. Thanks in advance. Example of my code: Code: <tr> How to change a color of the inputbox on form_error validation? - El Forum - 05-02-2012 [eluser]CroNiX[/eluser] Code: //Check to see if there was an error for this field, if there was change the class to "error" Then assign the class to your form_input() in the 3rd parameter. How to change a color of the inputbox on form_error validation? - El Forum - 05-02-2012 [eluser]term25[/eluser] Thanks a lot, it's working perfectly. How to change a color of the inputbox on form_error validation? - El Forum - 05-03-2012 [eluser]Aken[/eluser] You should use valid HTML in the third parameter, though. Code: <?php echo form_input('title', set_value('title'), 'class="title '.$title_class.'"'); ?> |