Submissions
Similar to Craft Entries, every time a user submits a form, we refer to those as submissions. Currently, submissions can be viewed and edited in the control panel, and displayed on the front end in templates as a list and individually.
Control Panel
The list of submissions in the control panel appears very similar to how regular Craft Entries are displayed. You can filter the view by form (or show across all forms), search into submissions, adjust which field columns are shown, and click into any of the submissions to edit them.
Additionally, you can keep track of changes or make private notes by using the Notes feature in the right column of the single submission view inside the CP (similar to older versions of Craft).
Freeform also includes a chart that gives you a quick visual of how many form submissions your site is receiving.
Front End Templates
One common use case might be displaying the contents of the form submission to the user that submitted it right after they have successfully submitted the form, allowing them to review what they submitted. Of course, be aware that there are security implications here if the submissions contain sensitive content.
If the information is not sensitive, and meant to be public - like comments, you can also display submissions in a paginated (or not) list.
For more information about this, please visit the Submissions query documentation.
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.
Disabling of Notifications and moreRevised and renamed in 5.0+
You can apply the disable
parameter to the Form and render
queries, which allows you to disable email notifications, API integrations and Element integrations for a form by passing an object of items you wish to disable, typically used for editing submissions, e.g.:
adminNotifications: true
- disable Admin notificationsconditionalNotifications: true
New in 5.0+ - disable Conditional notifications.userSelectNotifications: true
Renamed in 5.0+ - disable User Select notifications.emailFieldNotifications: true
Renamed in 5.0+ - disable Email Fields notificationsapi: true
- disable CRM and Email Marketing integrationselements: true
Renamed in 5.0+ - disable creation of new elements via Element integrations (will not disable Element validation, e.g. required fields, username already in use, etc).payments: true
- disable Payment integrationswebhooks: true
- disable any Webhooks for the form
You can also just set this to true
(disable: true
) to disable all items at once.
Examples
{% set form = freeform.form("myForm", {
attributes: {
id: "myform",
class: "form-class"
},
submissionToken: submissionToken|default(null),
disable: {
adminNotifications: true,
emailFieldNotifications: true,
api: true
}
}) %}
OR
{% set form = freeform.form("myForm", {
attributes: {
id: "myform",
class: "form-class"
},
submissionToken: submissionToken|default(null),
disable: true
}) %}
Submission LimitsPro
If you need to set limits on the number of submissions a form may receive or who can submit the form, a few options are available:
Duplicate CheckProRenamed and Improved in 5.0+
Inside the Settings → Limits area in the form builder, a Duplicate Check setting exists to allow you to limit the number of times a specific user can submit the form.
- Do not limit (default - no duplicate check applied)
- Logged in Users Only - No Limit
- Logged in Users Only - Once per Form
- Anyone - Once per Email Address
- This will check any Email field type for a matching email address (across all Email fields if using more than one in the same form).
- Anyone - Once per Logged in User or Guest Cookie
- Anyone - Once per Logged in User or Guest IP or Cookie
Templating
Freeform includes validation to prevent duplicate submissions (when the user tries to submit the form again), but if you wish to prevent users from even being able to see the form (and display an error/notice in its place), you can use duplicate
(form object) as a conditional. It's a bool variable, which will be true
if the form has the Duplicate Check setting enabled and the user has already submitted the form.
{# Replace 'myForm' with your form handle. #}
{% set form = freeform.form("myForm") %}
{# Check if user has already submitted the form #}
{% if form.duplicate %}
{# Hide form and display error message #}
<p class="alert">You've already submitted this form!</p>
{% else %}
{# Display form if not yet submitted by the user #}
{{ form.render }}
{% endif %}
Total Submissions Per FormPro
Freeform includes the ability to set a limit on the maximum number of submissions a form may receive, and the reject any additional ones. This is a template-level feature. You can also include a template-based condition check and display an alternate message without ever presenting the form to the user in the event it's reached it's limit.
Templating
The key is applying the submissionLimit
parameter to the Form query and feeding it a number value. This could be hardcoded or you could grab this value from somewhere else such as another element or global variable, etc. Here's an example of what that may look like:
{# Replace 'myForm' with your form handle. #}
{% set form = freeform.form("myForm") %}
{# Specify the submission limit here (or grab this value from somewhere else such as another element or global variable, etc) #}
{% set submissionLimit = 50 %}
{# This optional conditional checks if the form has reached its submission limit set above #}
{% if freeform.submissionCount(form) >= submissionLimit %}
<p class="alert">Submission Limit Reached!</p>
{% else %}
<p class="notice">
This form has a limit of {{ submissionLimit }} submissions.
There are currently {{ freeform.submissionCount(form) }} submissions for this form.
</p>
{{ form.render({
submissionLimit: submissionLimit,
}) }}
{% endif %}
Stop After Date
Inside the Settings → Limits area in the form builder, a Stop Submissions After Date setting exists to allow you to prevent new submissions of the form after the specified date.
This date will be validated against when editing submissions as well.