Answers.Body: <p>Wouldn't it be smarter to create a new invisible field and add it to the relevant form and then dynamically fill it in with the date in the front-end template.</p>
  <p>This way you could filter submissions via custom fields.
  As below:</p>
  <pre><code>{% set submissions = craft.freeform.submissions({
    fieldSearch: {
      yourDateField: 'now'|date('d M Y')
    }
  }) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-28T14:07:25.520Z
Answers.LastActivityDate: 2021-11-28T14:07:25.520Z
Answers.UserDisplayName: Jay V
Answers.Body: <p>I managed to get this working in the end. Here is my final code;</p>
  
  <pre><code>{# Calculate entries per day #}
  {% set form = entry.form %}
  {% set todaysEntriesIndex = 0 %}
  {% set submissions = craft.freeform.submissions({
      form: form.handle
  }).all() %}
  
  {# Count each submission from the day #}
  {% for submission in submissions %}
      {% if submission.dateCreated | date('d/m/Y') == 'now' | date('d/m/Y') %}
          {% set todaysEntriesIndex = todaysEntriesIndex + 1 %}
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>Once this has been setup you can use the following to check the amount:</p>
  
  <pre><code> todaysEntriesIndex &gt;= 200
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T11:04:35.690Z
Answers.Text: After running this for a few weeks, it works, but becomes poorly performant the more entries you have (as you've search through each entry).
  
  You can always set your limit in the submissions call to limit it to the number you are looking for.
Answers.UserDisplayName: Harry Francis
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-10T16:28:50.607Z
Answers.LastActivityDate: 2019-12-10T19:06:18.940Z
Answers.LastEditDate: 2019-12-10T19:06:18.940Z
Answers.UserDisplayName: Harry Francis
Body: <p>I am using freeform to manage forms on my site.</p>
  
  <p>I'd like to limit the number of entries on a form to 200 per day.</p>
  
  <p>The method I thought would be best is to get the submissions for the form, and use the dateCreated parameter to only return those that matched today's date.</p>
  
  <p>Here's my code</p>
  
  <pre><code>{% set form = entry.form %}
  {% set submissions = craft.freeform.submissions({
      form: form.handle,
      dateCreated: 'now' | date('d M Y')
  }) %}
  
  {{ submissions | length }}
  </code></pre>
  
  <p>But it isn't working. Am I getting the date parameter wrong?</p>
  
Tags: <form><plugin-freeform><solspace>
Title: Limiting form entries per day in FreeForm
ThreadText: # Limiting form entries per day in FreeForm
  
  (Asked by: username_0 on 2019-11-13)
  
  I am using freeform to manage forms on my site.
  
  I'd like to limit the number of entries on a form to 200 per day.
  
  The method I thought would be best is to get the submissions for the form, and use the dateCreated parameter to only return those that matched today's date.
  
  Here's my code
  
  ```
  {% set form = entry.form %}
  {% set submissions = craft.freeform.submissions({
      form: form.handle,
      dateCreated: 'now' | date('d M Y')
  }) %}
  
  {{ submissions | length }}
  
  ```
  
  But it isn't working. Am I getting the date parameter wrong?
  
  **Tags:** form, plugin-freeform, solspace
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-11-28. Score: 1
  
  Wouldn't it be smarter to create a new invisible field and add it to the relevant form and then dynamically fill it in with the date in the front-end template.
  
  This way you could filter submissions via custom fields.
  As below:
  
  ```
  {% set submissions = craft.freeform.submissions({
    fieldSearch: {
      yourDateField: 'now'|date('d M Y')
    }
  }) %}
  
  ```
  
  
  ---
  
  ### Answer by username_0 on 2019-12-10. Score: 1
  
  I managed to get this working in the end. Here is my final code;
  
  ```
  {# Calculate entries per day #}
  {% set form = entry.form %}
  {% set todaysEntriesIndex = 0 %}
  {% set submissions = craft.freeform.submissions({
      form: form.handle
  }).all() %}
  
  {# Count each submission from the day #}
  {% for submission in submissions %}
      {% if submission.dateCreated | date('d/m/Y') == 'now' | date('d/m/Y') %}
          {% set todaysEntriesIndex = todaysEntriesIndex + 1 %}
      {% endif %}
  {% endfor %}
  
  ```
  
  Once this has been setup you can use the following to check the amount:
  
  ```
   todaysEntriesIndex >= 200
  
  ```
  
  > **Comments:**
  > **username_0**: After running this for a few weeks, it works, but becomes poorly performant the more entries you have (as you've search through each entry).  You can always set your limit in the submissions call to limit it to the number you are looking for.  
  
  ---
  
  