• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want validation_errors with <br>, but just one <br> between errors message.

Hi all,

How can I archieve that the out of my
function put just one
tag between the error messages?

I test with something like
and nothing,
tags are inserted between error messages, and I just want one
tag as separator.


Just do this code:

Username &lt;input type='text' name='username'&gt;
&lt;?php echo br(); ?&gt;
&lt;?php echo validation_errors(); ?&gt;

You have to set the html helper

or set it manually in html code
Username &lt;input type='text' name='username'&gt;&lt;br />
&lt;?php echo validation_errors(); ?&gt;

Seem to me that I don't explain myselfWink

What I want is that the separation tag be another one than <p></p> between the multiple erros message that validation_errors() print, so in some way I must control what validation_errors() does, cos I can't inser br between the each message cos validation_errors print all messages as a whole. I tested passing first parameter (separation tag) to validation_errors() and don't work, the problem is that if you don't pass the open and close tag, the function still add <p>, and that break my HTML.

Looking at the code for validation_errors($open, $close), it seems if you pass an empty open or close string it defaults back to whatever the default is for $form_validation->error_prefix and $form_validation->error_suffix, which is a p tag, or whatever they have been set to using set_error_delimiters().

So it seems, you should use
$this->form_validation->set_error_delimiters('', '<br />');
to set those defaults and then this should probably work.

echo validation_errors('', '<br>');

Thanks a lot!

I hope this bug get fixed in future CI versions.

Thanks again.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.