Skip to content

[6.x] Forms 2: Access#14950

Open
duncanmcclean wants to merge 6 commits into
forms-2from
forms-2-access-restrictions
Open

[6.x] Forms 2: Access#14950
duncanmcclean wants to merge 6 commits into
forms-2from
forms-2-access-restrictions

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Jul 7, 2026

Copy link
Copy Markdown
Member

This pull request implements form access controls, letting you restrict when a form accepts submissions. You can schedule a close date, cap the number of submissions, and require visitors to be logged in.

These "restrictions" can be configured in the form's settings. They're enforced server-side when the form is submitted and surfaced to templates so they can limit when the form is rendered.

Options

CleanShot 2026-07-07 at 15 26 50

When a limit period is set, the counter resets at the app timezone's midnight / start of the week / start of the month.

Preventing submissions

The simplest way to prevent visitors submitting closed forms is to wrap the form's contents in a conditional:

{{ form:contact }}
    {{ if restricted }}
        <p>{{ restriction_message }}</p>
    {{ else }}
        {{ fields }} ... {{ /fields }}
    {{ /if }}
{{ /form:contact }}

Statamic will also reject submissions server-side and return a validation error when a form is restricted.

Form status

This PR adds a $form->status() method which returns open, closed, or limit_reached.

The status is visitor-agnostic — describing the form's lifecycle rather than if a given visitor can access the form (so require_login doesn't affect it.

A status indicator has been added to form pages across the Control Panel:

CleanShot 2026-07-07 at 15 25 38 CleanShot 2026-07-07 at 15 25 26

@duncanmcclean duncanmcclean requested a review from jasonvarga July 7, 2026 14:34
Comment thread src/Forms/Form.php Outdated
Comment thread src/Forms/Form.php Outdated
@duncanmcclean duncanmcclean requested a review from jasonvarga July 7, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants