1 Reply Latest reply on Jul 7, 2014 9:46 PM by George_Johnson

    Limiting Check Boxes by User


      How can I limit the number of check boxes a user can select?  I created the form in Acrobat XI, there are 20 check boxes and are named "chkBox0 thru chkBox20."

        • 1. Re: Limiting Check Boxes by User
          George_Johnson MVP & Adobe Community Professional

          Here's a sample form that demonstrates one way to do this: https://workspaces.acrobat.com/?d=j-aUbc3YTz1uu8Jx0LvzHg


          Each check box calls the same function that's defined in a document-level JavaScript. You'll have to study it a bit to see how it works.



          Here's the document-level function:


          function limitCheckNumber(prefix, lower, upper, max) {


              // Initialize the selected check box count

              var count = 0;


              // Loop through the check boxes to see if the limit has been exceeded

              for (var i = lower; i < upper + 1; i += 1) {


                  // Increment the counter if the current check box is selected

                  if (getField(prefix + "." + i).value !== "Off") count += 1;


                  // If the count exceeds the limit, deselect the check box that was just selected

                  // and alert the user

                  if (count > max) {

                      event.target.value = "Off";

                      app.alert("A maximum of " + max + " check boxes can be selected", 3);






          And here is the Mouse Up script for each check box:


          limitCheckNumber("check", 0, 9, 4);


          The check boxes are named: check.0, check.1,...,check.9, and it's limited to 4 check boxes max selected at one time.

          1 person found this helpful