Freeform Freeform for Craft

Submissions

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.

WARNING

Currently, only Freeform submission titles can be searched upon inside the control panel. This is due to the way things are set up with Freeform having its own field architecture and using the Craft Element Index for displaying submission data. As a workaround, you may wish to set up your submission Titles to include some of the main fields' data. We intend on addressing this in a future version of Freeform.

Submissions Edit Submissions

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 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 Form query, 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 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 %}
1
2
3
4
5

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),
}) %}
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.

Disabling of Notifications and more Revised 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 notifications
  • conditionalNotifications: 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 notifications
  • api: true - disable CRM and Email Marketing integrations
  • elements: 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 integrations
  • webhooks: 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
    }
}) %}
1
2
3
4
5
6
7
8
9
10
11
12

OR







 


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

Submission Limits Pro

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 Check ProRenamed 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 %}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Total Submissions Per Form Pro

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 %}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

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.

WARNING

This date will be validated against when editing submissions as well.