This document is for an older version of

Freeform

.

View latest version →

Overview

Submission Editing Pro

Freeform allows you to edit submissions via the front end templates as well. Currently, this feature has no user/author check, and requires you use/provide the submission.token to work (as opposed to the ID). A future version will likely include ability to check on authors, etc. The editing uses the same freeform.form function, but knows you're in edit mode when you feed the submissionToken parameter a valid value.

WARNING

There are currently some limitations with this feature. Please note that:

  • Not all types of forms can be intuitively edited (e.g. Payment forms, some complex ones, etc).
  • Editing Payment forms will NOT update payment details, but instead will make a new submission/charge.
  • Editing forms with Element Connections will NOT update the corresponding element, but just create a new one instead (so currently no editing of user profile data, etc).

Overview

When linking to the form edit, you might use something like this inside the freeform.submissions function:

{% if currentUser and currentUser.admin %}
    <a href="{{ siteUrl }}page/{{ form.handle }}/edit/{{ submission.token }}">
        {{ "Edit"|t("freeform") }}
    </a>
{% endif %}
1
2
3
4
5

Then in your template that includes the freeform.form, be sure that the submissionToken parameter is included and checking the URL for a value:

 



 


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

{% set form = craft.freeform.form('myForm', {
    returnUrl: "{{ siteUrl }}page/{{ form.handle }}/submission/{{ submission.id }}/success",
    submissionToken: submissionToken|default(null),
}) %}
1
2
3
4
5
6

You can also check out the example in the demo templates if you wish to see it in action.

Suppression of Notifications and more

You can apply the suppress parameter to the freeform.form and render functions, which allows you to suppress email notifications, API integrations and Element Connections for a form by passing an object of suppressions you wish to enable, typically used for editing submissions, e.g.:

You can also just set this to true (suppress: true) to enable all suppressions at once.

Examples





 
 
 
 
 
 


{% set form = craft.freeform.form("myForm", {
	id: "myform",
	class: "form-class",
    submissionToken: submissionToken|default(null),
    suppress: {
        adminNotifications: true,
        dynamicRecipients: true,
        submitterNotifications: true,
        api: true
    }
}) %}
1
2
3
4
5
6
7
8
9
10
11

OR





 


{% set form = craft.freeform.form("myForm", {
	id: "myform",
	class: "form-class",
    submissionToken: submissionToken|default(null),
    suppress: true
}) %}
1
2
3
4
5
6