CodeIgniter Forums
Validation AlertBox - 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 AlertBox (/showthread.php?tid=35488)



Validation AlertBox - El Forum - 10-31-2010

[eluser]Funky Fresh[/eluser]
Hey Guys,

I have a form which has quite a few fields on it.

When i submit the form and not fill anything in, it hits the validation and comes back and displays all the errors at the top which pushes the html right down.

Is there any way to put the returning error messages into an javascript alertbox, each error underneath the other.

Basically i just use the following code to output errors

Code:
<div align="center" style="color: red; font-weight: bold;">
    &lt;?php echo validation_errors(); ?&gt;
</div>



Validation AlertBox - El Forum - 10-31-2010

[eluser]K-Fella[/eluser]
I would advise against using a javascript alert. Instead why not display an error under each field.

See: http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#individualerrors