How do I set an error/success message in the ExpressionEngine admin panel from a bespoke add-on I'm developing?
I have a form, and wish to send back the result (i.e. "Form submission as successful") in the area where messages usually appear in the admin panel. Example in screen-shot below:
JS method $.ee_notice
$.ee_notice("Your success message", {type: "success", open: true});
OR
$.ee_notice("Your error message", {type: "error", open: true});
If you're doing a redirect after a form post, you can use set_flashdata prior to the redirect:
$this->EE->session->set_flashdata('message_success', 'Your success message');
$this->EE->functions->redirect($url);
OR
$this->EE->session->set_flashdata('message_failure', 'Your error message');
$this->EE->functions->redirect($url);