WCMS 3 Advent calendar #20: limiting quantities on a webform element

Monday, December 20, 2021
by Kevin Paxman

Do you know that you can assign quantity limits to select webform elements? This functionality became available with the launch of WCMS 3.1.1.

To start, add a supported element as you usually would. Here, we have used a select list to ask conference goers what type of swag they would like to receive.

screenshot showing swag option entry


Assuming there are limits on how much swag you can give out, this type of question would have been tricky - you would have had to do something like put in a disclaimer that you would bump people down to the next level of swag if you ran out, or constantly be checking the form and removing options when you hit the submission limit.

Now, you would go to the form's settings, under emails/handlers, and add a "options/checkbox limit" handler. From there, you would select the element you want to put limits on, and enter those limits. For our example, we will say that there are 10 packs of "fancy" swag available, 90 of the normal, and no limits on how many people can pick "no swag".

a screenshot showing the setting of limits


By default, the limits are shown on the form. Any items that do not have any quantity remaining are disabled, so that they cannot be selected.

screenshot showing the swag selection form


You can override these behaviours by configuring the option/checkbox settings of your handler. You can have it remove options when they are no longer available. You can enter your own static messages, or use placeholders to show dynamic messages; you can also leave the message blank to display no message at all.

screenshot of the options/checkbox settings
screenshot showing the swag selection after the options are changed


So, while WCMS 3's primary goal is reducing limits, you could say we've intentionally added some here.

a decorative line

How did you like this tip? Is this something you are already doing, or maybe something you will look to adapt? Are you inspired with suggestions for future tips? Send us feedback!