Search by

digitaldiff / formie-quota

diff

A Formie Radio Buttons field where each option has a limited quota, based on completed submissions.

Package info

github.com/digitaldiff/formie-quota

Type:craft-plugin

pkg:composer/digitaldiff/formie-quota

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

5.0.0 2026-09-14 06:53 UTC

This package is auto-updated.

Last update: 2026-09-14 07:35:33 UTC


README

Private Craft CMS 5 plugin adding a "Radio Buttons (Kontingent)" field type to Formie: a Radio Buttons field where every option has a limited quota.

Requirements

  • Craft CMS 5.0+
  • PHP 8.2+
  • Formie 3.0+

How it works

  • Each option gets a "Kontingent" number, entered in the field's options table in the form builder (alongside label, value, default, disabled).
  • The remaining amount is never stored - it's computed live by counting completed, non-spam, non-deleted submissions that selected that option. Deleting a submission (or marking it as spam) frees its slot again automatically, with nothing extra to keep in sync.
  • A submission is rejected on save if its selected option's quota is already used up.
  • On the front-end, the remaining quota is shown in parentheses next to each option's label, and an exhausted option's input is rendered disabled.
  • Quota tracking is scoped per field instance (Formie's field UID), so using this field type on multiple forms tracks each one's quota independently - no shared quota pool across forms.

Known limitation

Counting submissions instead of maintaining a dedicated, atomically updated counter means there is a small race window: two submissions arriving in the same instant for the very last slot could in theory both get through. This trade-off was made deliberately in favour of not maintaining a separate database table. If that ever becomes a real problem, the fix would be a SELECT ... FOR UPDATE lock on the field's own row in formie_fields during the check, not a new table.