Would you like to limit how many checkboxes a user can select within a Checkboxes field? Normally, a Checkboxes field will allow any number of boxes to be checked, but in some situations, you might want to limit the number of allowed selections.
This tutorial will show you how to easily limit the number of checkboxes that can be selected.
Before getting started, you’ll first need to make sure WPForms is installed and activated on your WordPress site, and that you’ve verified your license. Then, you can create a new form or edit an existing one to access the form builder.
Note: Are you looking to limit the number of choices in the Checkbox Items field used in payment forms? If so, you’ll need to use a custom code snippet, which we detail in our developer doc on limiting choices in a Checkbox Items field.
Adding a Checkbox Limit
Once the form builder is open, go ahead and add a Checkboxes field to your form.
Now, click on this field in the preview area to open its Field Options.
Next, within the Field Options panel, click on the Advanced tab to open the field’s advanced options.
Then, within the Choice Limit field, add the maximum number of checkboxes you’d like your users to be able to select. For our example, we’ll limit our users to only 2 choices.
Once you’ve added your choice limit, be sure to save your form.
Note: If you’d like your users to only be able to select one option at a time, we recommend using the Multiple Choice field. See our guide to using the Multiple Choice field for more details.
Testing Your Form
For the last step in this setup, we recommend testing your form so you can check that it looks and works how you’d like. Our detailed guide on testing forms shares a checklist of recommended steps to consider before publishing your forms.
For this particular feature, the main thing you should notice when testing your form is the validation message. This message appears when a user has exceeded the number of allowed selections. The user will not be able to submit the form until they select the correct number of boxes.
That’s it! You can now limit the number of boxes that a user can check in a Checkboxes field.
Next, would you like to try some of the other customization options for the Checkboxes field? Be sure to check out our tutorials on randomizing checkbox options, creating multi-column layouts, and enabling survey reports.