Skip to content

Close a form on a date

github-actions[bot] edited this page Oct 30, 2026 · 2 revisions

Written against v0.1.0.

A form should accept submissions only between two dates, and the page should show a message outside that window instead of the form.

Steps

  1. Open the form's settings screen and go to Restrictions.
  2. Switch on Schedule the Form, then set Start Date and Time and End Date and Time under Form Schedule.
  3. Write Message to Display When the Form is Pending (shown before the start) and Message to Display When the Form Has Expired (shown after the end). Save the form.
  4. In the form's template, wrap the form in the form_restriction tag:
{{ form_restriction handle="contact" }}
    {{ if open }}
        {{ form:contact }} ... {{ /form:contact }}
    {{ else }}
        <p>{{ message }}</p>
    {{ /if }}
{{ /form_restriction }}

Before the start the tag reports pending, after the end expired, and inside the window open. A submission outside the window is refused whether or not the template uses the tag. A start or end date that cannot be read as a date closes the form with the state schedule_unreadable.

Reference

Clone this wiki locally