Show Submission Data on Success Page

You cannot display POST data on the success return page because that data is cleared upon submission, which is done because for security reasons and preventing forms from being submitted more than once, etc.

You can however, consider another approach. Freeform allows you to display submissions on the front end. It also allows you to set the return URL to include the future submission ID. You can set this either in the Return URL field for the form in Composer, or at template level like:

returnUrl: "{{ siteUrl }}your-page/success/{{ submission.id }}"
1

WARNING

Using this approach can be a security risk as site visitors could try out other ID's in the URL and view submission data for those submissions. It's strongly recommended that you refrain from displaying any sensitive data, but instead use this for anonymous polls or something simple like:

Thanks {{ submission.firstName }}, we've received your message and will get back to you shortly!
1

However, if you do wish to include sensitive information, you can consider pairing the submission ID with the Freeform token in the URI. See the token property in the Submission object and the token parameter in the freeform.submissions function for more information. The resulting code would look like:

returnUrl: "{{ siteUrl }}your-page/success/{{ submission.id }}/{{ submission.token }}"
1

Or even just:

returnUrl: "{{ siteUrl }}your-page/success/{{ submission.token }}"
1

While the Success return page would contain the following:


 
 



{% set submission = craft.freeform.submissions({
    id: craft.app.request.getSegment(3),
    token: craft.app.request.getSegment(4),
    form: 'myFormHandle',
}).one %}
1
2
3
4
5

Or with token only:


 



{% set submission = craft.freeform.submissions({
    token: craft.app.request.getSegment(3),
    form: 'myFormHandle',
}).one %}
1
2
3
4
Last Updated: 2/12/2019, 11:48:47 PM