Freeform Success Notice in Template I am having trouble getting a freeform success message to display. I am posting back to the same template. What is the proper way to check if the form was posted? I see in the freeform render template there is a freeform.hasErrors, is there something for success perhaps?

            {% if craft.request.getPost('firstName')|length %}

                &lt;div class="callout success"&gt;Your message has been sent.&lt;/div&gt;

            {% else %}

                {{ craft.freeform.form("contactForm", {
                        formAttributes: { "data-abide": true }, 
                        instructionsBelowField: true, 
                        submitClass: "button", 
                        returnUrl: "/contact", 
                        useRequiredAttribute: true
                    }
                ).render() }}

            {% endif %}


https://solspace.com/craft/freeform/docs

Update: Working code using query param instead. Thanks @Jan_dh.

            {% if craft.request.getQuery('success') == 1 %}

                &lt;div class="callout success"&gt;Your message has been sent.&lt;/div&gt;

            {% endif %}

            {{ craft.freeform.form("contactForm", {
                    formAttributes: { "data-abide": true }, 
                    instructionsBelowField: true, 
                    submitClass: "button", 
                    returnUrl: "/contact?success=1", 
                    useRequiredAttribute: true
                }
            ).render() }}

            {% endif %}
You can add a param to your returnUrl in the form composer then check the template for the param.

For example:

You redirect to /contact?success

{% set successParam = craft.request.getParam('success') %}
{% if successParam is not null %} 
  &lt;p&gt;Hooray! Success!!&lt;/p&gt;
{% endif %}


Another option is to Ajax submit your form and just have a modal or something on a succes submit. An example of an Ajax submit can be found in the official freeform docs here.