CodeIgniter Forums
Error message after form validation runs successful - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Error message after form validation runs successful (/showthread.php?tid=61865)



Error message after form validation runs successful - groovebird - 05-26-2015

Hi,

is it possible to set an error message AFTER form validation runs successful?
The reason is, i want to include mailchimp and mailchimp blocks email adresses. if so, i want to show an error message.

PHP Code:
if ($this->form_validation->run() === true) {
 
   // connect to mailchimp
 
   // if mailchimp throw an error, show an error message




RE: Error message after form validation runs successful - mwhitney - 05-27-2015

Generally, if you want the message to be output by the form_helper's validation_errors() and/or form_error() functions, or via $this->form_validation->error() and/or $this->form_validation->error_string(), you will probably need to create a custom validation rule to run during validation.

Otherwise, you would simply handle the error the same way you handle a validation error. Generally, you would pass the error message through to the view and display it the same way you would a validation error.