Welcome Guest, Not a member yet? Register   Sign In
Help displaying errors with Form Validation

I'd like to be able to display the form validation errors at the top of the page and then have each form element (like input) outlined in red or have an arrow next to it to tie the two together.

I haven't found a way to do this yet. All I have found is the echo form_error() which places the error next to the form element.

Any help would be greatly appreciated.



You can use form_error() to set a class for your element if there is an error:

<label for="text" &lt;?php echo (form_error('text')) ? ' class="error"' : ''; ?&gt;>Text:</label><br />
&lt;input type="text" name="text" value="&lt;?php echo set_value('text'); ?&gt;" /&gt;

Perfect. That is exactly what I was looking for.


Theme © iAndrew 2016 - Forum software by © MyBB