Freeform Documentation

Learn the basics, and get to know Freeform inside and out.

Freeform 1.x Docs

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 %}