Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AngellusMortis opened this issue Apr 18, 2018 · 1 comment
Open

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

AngellusMortis opened this issue Apr 18, 2018 · 1 comment

Comments

@AngellusMortis
Copy link

AngellusMortis commented Apr 18, 2018

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
@luzfcb
Copy link

luzfcb commented Apr 20, 2018

cool new feature.

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

No branches or pull requests

2 participants