Check if a form field has an error |
[eluser]Joseph Wensley[/eluser]
Is there a to check if a form field has an error? I don't care what the error is I just need to know if there is any error for the field. I extended the form helper with this function but I'm not sure if there are cases where it will fail. Code: function field_has_error($field)
[eluser]hugle[/eluser]
Hey, I simply do: <?php if (form_error('contact_email')) echo ' error'; ?> If I want to add error class for example
[eluser]Brad K Morse[/eluser]
Check out http://ellislab.com/codeigniter/user-gui...ationrules You can set rules for each field, then test to make sure all fields passed validation. Also check out an example http://ellislab.com/codeigniter/user-gui...l#tutorial |
Welcome Guest, Not a member yet? Register Sign In |