This document is for an older version of

Freeform

.

View latest version →

Deleting Submissions By Token

Freeform includes a way for users to delete their own submissions. This can be done with the token feature. A typical setup might have you include a link inside an email notification sent to a user that filled out a form. You would include {{ submission.token }} in the URL you generate that is linked to a template with the below example code to allow the user to delete their own submission.

{% set token = craft.app.request.segment(4) %}

{% if craft.freeform.deleteSubmissionByToken(token) %}
  Removed successfully
{% else %}
  Nothing to remove
{% endif %}
1
2
3
4
5
6
7