1. Computing

Limiting Selections

1. Sample Page

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

Obtain the Script Add to Your Page

Radio buttons are the ideal choice where you want your visitor to select one out of a number of different options but if you want to allow more than one option to be selected then you can't use radio buttons. If we just use checkboxes instead then our visitor will be able to select any number of options between zero and the total number of choices given. There is no button format that just allows two or three out of a larger number of options to be selected.

We can solve this problem by using some simple Javascript code to convert ordinary checkboxes into checkbox groups where there is a maximum number of entries within each group that can be selected.

Here is an example where checkboxes and Javascript are used to set up a couple of selection groups where more than one option in each group is allowed to be selected.

Please select up to 2 boxes and 3 hats.
Boxes: 1 2 3 4 5
Hats: 1 2 3 4

The first step to add this functionality to your forms is to obtain the script.

©2013 About.com. All rights reserved.