Submission EditingPro
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). submissionToken
parameter a valid value.
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 integrations 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 Submissions query:
{% if currentUser and currentUser.admin %}
<a href="{{ siteUrl }}page/{{ form.handle }}/edit/{{ submission.token }}">
{{ "Edit"|t("freeform") }}
</a>
{% endif %}
Then in your template that includes the Form query, be sure that the submissionToken
parameter is included and checking the URL for a value:
{% set submissionToken = craft.app.request.segment(4) %}
{% set form = freeform.form('myForm', {
returnUrl: "{{ siteUrl }}page/{{ form.handle }}/submission/{{ submission.id }}/success",
submissionToken: submissionToken|default(null),
}) %}
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 Form and render
queries, 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.:
adminNotifications: true
- suppress Admin notificationsdynamicRecipients: true
- suppress Dynamic Recipient notificationssubmitterNotifications: true
- suppress Submitter email notificationsapi: true
- suppress CRM and Email Marketing integrationsconnections: true
- suppress Element Connectionspayments: true
- suppress Payment integrations
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
}
}) %}
OR
{% set form = craft.freeform.form("myForm", {
id: "myform",
class: "form-class",
submissionToken: submissionToken|default(null),
suppress: true
}) %}