validation errors output - 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 errors output (/showthread.php?tid=2339) |
validation errors output - El Forum - 07-30-2007 [eluser]Bacteria Man[/eluser] Here's a simple tip, which might save somebody a couple of minutes. The default output of each validation error is wrapped in paragraph tags. I wanted to use list item tags. Fortunately the Validation class defines two properties, _error_prefix and _error_suffix, which makes it easy to change them. Create an extended class (if you haven't previously done so) and define the new values in the Constructor. Code: class My_Validation extends CI_Validation validation errors output - El Forum - 07-30-2007 [eluser]Michael Wales[/eluser] Doesn't the following code work? Code: $this->validation->set_error_delimiters('<li>', '</li>'); validation errors output - El Forum - 07-30-2007 [eluser]Bacteria Man[/eluser] [quote author="walesmd" date="1185855961"]Doesn't the following code work? Code: $this->validation->set_error_delimiters('<li>', '</li>'); Yeah, sure, if you want to do it the easy way. :-) Thanks... same difference actually, but I completely missed that function. Rick didn't miss a trick. validation errors output - El Forum - 07-31-2007 [eluser]kirkaracha[/eluser] I display the errors at the top of my form views like this: Code: <?php if(isset($page_type) && $page_type=='form'){ Code: <?php validation errors output - El Forum - 07-31-2007 [eluser]Bacteria Man[/eluser] Thanks for sharing your snippet. I'm going to do something global like that. |