Skip to content

Add option to limit number of submissions for a form #222

Open
@AngellusMortis

Description

@AngellusMortis

As a user, I would like to be able to limit the number of submissions made to a form so that the form does not get too many respondents.

We have had a use case to automatically close a form and stop new submissions to a form once it reaches a set limit of submissions (like a form asking for interest in a training classes, you need to stop people from submitting after you get ~30 submissions or something).

I have already made this change on an internal fork we have and can submit the PR if interested.

What I did:

  • added new field to AbstractForm for max_submissions, < 0 = no max.
  • added new status for "Closed", closed differs from "Draft" in that it still will display the form page will load and not return a 404.
    • If you are a non-staff user, you will get the form title and intro for a closed form as well as an error message stating the form is closed to new submissions.
    • If you are a staff user, you will still get the full form (for testing) and upon submission, you will get a error message stating the form is closed to new submissions.
    • Forms will automatically switch to "Closed" upon the first form that is submitted that reaches the max_submissions value if it is positive
  • published on both the FormManager and AbstractForm now returns forms of "Published" and "Closed" forms. Logic for "Closed" forms is only enforced in the view logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions