<p>You can see in the <a href="https://github.com/pixelandtonic/ContactForm/blob/master/contactform/controllers/ContactFormController.php#L148" rel="nofollow">code for the plugin on GitHub</a> that it sets a 'notice':</p>

<pre><code>craft()-&gt;userSession-&gt;setNotice($settings-&gt;successFlashMessage);
</code></pre>

<p>As the <a href="https://craftcms.com/classreference/services/UserSessionService#setNotice-detail" rel="nofollow">official documentation</a> mentions, this can later be grabbed with the following code:</p>

<pre><code>{% set message = craft.session.getFlash('notice') %}
</code></pre>

<p>Then used as a normal message thereafter.</p>

<pre><code>{{ message }}
</code></pre>

CC BY-SA 4.0
2018-10-08T21:10:51.023Z
Are there new URLs for the referenced links, here?
buck1112
CC BY-SA 3.0
2016-08-11T09:32:37.697Z
2016-08-11T10:06:34.427Z
2016-08-11T10:06:34.427Z
Stephen Hamilton
<p>Kind of feel silly having to ask this but I cannot for the life of me get a success message to display after the redirect when the Contact Form submits.  </p>

<p>I just am not sure how to call it in the template view.</p>

<p>I have tried various things like this:</p>

<pre><code>{% set success = craft.config.get('successFlashMessage', 'contactform') %}

{% if success %}
  &lt;div class="resp"&gt;&lt;h3&gt;{{ success }}&lt;/h3&gt;&lt;/div&gt;
{% endif %}
</code></pre>

<p>But just cannot seem to grab it.</p>

<p>I did look at the documentation on Github and was not able to find it.</p>

CC BY-SA 3.0
2016-02-03T00:24:37.377Z
Is there a particular reason you want to use flash and not a redirect hidden input? https://github.com/pixelandtonic/ContactForm#redirecting-after-submit
Brad Bell
CC BY-SA 3.0
2016-02-03T23:01:28.180Z
No, I just cannot get it to display a message either way, I would like it to stay on the same page but it does not absolutely have to.
Rockwell Rice
CC BY-SA 3.0
2016-02-03T23:54:00.200Z
So you're saying even if you add a `<input type="hidden" name="redirect" value="success">`, you don't get redirected to `/success`?
Brad Bell
CC BY-SA 3.0
2016-02-04T00:32:33.683Z
The redirect works fine, but there is no message, sorry if it is unclear what I was asking, I am trying to figure out how to display a "your message has been sent" type message on the screen when the message has been successfully sent.
Rockwell Rice
CC BY-SA 3.0
2016-02-04T00:34:41.810Z
Ahh, if you're redirecting to a "success" template, then you can just hard code the "your message has been sent" message into the template. If there was a problem sending the email, the user is going to get an error page (either one supplied by you or a default Craft one)
Brad Bell
CC BY-SA 3.0
2016-02-04T00:41:49.123Z
Right, I really wanted to just flash the message, remove the form and possibly add the name though and keep them on the same page.  It's really not a big deal, I just seemed like one of those things that I thought would be simple at first and then I got totally bogged down doing and wanted to figure it out.
Rockwell Rice
CC BY-SA 3.0
2016-08-11T11:33:00.150Z
Are you using AJAX to submit your form? Or are you just redirecting to the same page upon submission?
Mats Mikkel Rummelhoff
<plugin-contactform>
How to display success message using the Contact Form plugin
# How to display success message using the Contact Form plugin

(Asked by: username_0 on 2016-02-02)

Kind of feel silly having to ask this but I cannot for the life of me get a success message to display after the redirect when the Contact Form submits.  
I just am not sure how to call it in the template view.
I have tried various things like this:
{% set success = craft.config.get('successFlashMessage', 'contactform') %}

{% if success %}
  {{ success }}
{% endif %}

But just cannot seem to grab it.
I did look at the documentation on Github and was not able to find it.

**Tags:** plugin-contactform
> **Comments:**
> **username_1**: Is there a particular reason you want to use flash and not a redirect hidden input? https://github.com/pixelandtonic/ContactForm#redirecting-after-submit  
> **username_0**: No, I just cannot get it to display a message either way, I would like it to stay on the same page but it does not absolutely have to.  
> **username_1**: So you're saying even if you add a `<input type="hidden" name="redirect" value="success">`, you don't get redirected to `/success`?  
> **username_0**: The redirect works fine, but there is no message, sorry if it is unclear what I was asking, I am trying to figure out how to display a "your message has been sent" type message on the screen when the message has been successfully sent.  
> **username_1**: Ahh, if you're redirecting to a "success" template, then you can just hard code the "your message has been sent" message into the template. If there was a problem sending the email, the user is going to get an error page (either one supplied by you or a default Craft one)  
> **username_0**: Right, I really wanted to just flash the message, remove the form and possibly add the name though and keep them on the same page.  It's really not a big deal, I just seemed like one of those things that I thought would be simple at first and then I got totally bogged down doing and wanted to figure it out.  
> **username_2**: Are you using AJAX to submit your form? Or are you just redirecting to the same page upon submission?  

---

## 1 answers

### Answer by username_3 on 2016-08-11. Score: 4

You can see in the code for the plugin on GitHub that it sets a 'notice':
craft()->userSession->setNotice($settings->successFlashMessage);

As the official documentation mentions, this can later be grabbed with the following code:
{% set message = craft.session.getFlash('notice') %}

Then used as a normal message thereafter.
{{ message }}

> **Comments:**
> **username_4**: Are there new URLs for the referenced links, here?  

---

