set_error_delimiters problem - 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: set_error_delimiters problem (/showthread.php?tid=16322) |
set_error_delimiters problem - El Forum - 03-03-2009 [eluser]Mitja B.[/eluser] The source code of error is <div class="errorValid">The Naslov field is required.</div> <div class="errorValid">The URL field is required.</div> and i am using $this->validation->set_error_delimiters('<div class="errorValid">', '</div>'); How can i make that all errors will be inside one div like <div class="errorValid"> The Naslov field is required.<br /> The URL field is required. </div> Thx set_error_delimiters problem - El Forum - 03-03-2009 [eluser]pistolPete[/eluser] I assume you are using CI 1.7.0+ The function which builds the error string looks like: Code: (...) If you want to change that behaviour, you have to subclass the form validation library: MY_Form_validation.php Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); set_error_delimiters problem - El Forum - 03-03-2009 [eluser]Mitja B.[/eluser] Thx for your help it works set_error_delimiters problem - El Forum - 03-03-2009 [eluser]TheFuzzy0ne[/eluser] Any reason why Code: <?php echo validation_errors(); ?> set_error_delimiters problem - El Forum - 03-03-2009 [eluser]pistolPete[/eluser] It's just a wrapper function: Code: function validation_errors($prefix = '', $suffix = '') set_error_delimiters problem - El Forum - 03-03-2009 [eluser]TheFuzzy0ne[/eluser] Sure, but it returns ALL of the errors together does it not? Isn't that what the OP wanted, or am I misunderstanding something (as usual)? set_error_delimiters problem - El Forum - 03-03-2009 [eluser]pistolPete[/eluser] Yes it returns all errors, but each error is wrapped into the error_delimiters. But he wanted to use the delimiters only once. Normal behaviour: Code: <delimiter>error message 1</delimiter> Changed to: Code: <delimiter> set_error_delimiters problem - El Forum - 03-03-2009 [eluser]TheFuzzy0ne[/eluser] I believe: Code: $this->validation->set_error_delimiters('', '<br />'); Code: <?php if ($errors = validation_errors()): ?> |