I have a plugin that accepts a form post. I need to return a notice or error, plus the original data. Starting with the notice/error first, I have tried this:
if (craft()->broadbean_jobs->createJob())
{
craft()->userSession->setNotice(Craft::t('Job created.'));
}
else
{
craft()->userSession->setError(Craft::t('Unable to create job.'));
}
$this->redirectToPostedUrl();
How can I display the notice or error in my template?
setNoticeandsetErrorand display flashes withgetFlash('notice')andgetFlash('error')respectively – Yuri Salimovskiy Jun 11 '16 at 10:02