These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Limited number of checkboxes

bonner
Registered: Nov 26 2010
Posts: 3

I'm doing a form in Acrobat Pro 8 and I have one section where there is a lot of checkboxes. Any user is only allowed to choose 6 of them - is there any way to limit it automatically? The from is primarily in a printed version and I'm doing the electronic one on the basis of a static pdf from printers.
 
Thanks for help.

My Product Information:
Acrobat Pro 8.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
Automatically, no. However, you can do it with a script.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

bonner
Registered: Nov 26 2010
Posts: 3
Looks like you know how would this script look. I don't. Any chance for more help?
maxwyss
Online
Registered: Jul 25 2006
Posts: 256
There are various ways to do it… a few possibilities:

For all of them, you woul use the MouseUp event of the checkbox to trigger the evaluation function.

• Define a variable which you increment with every time you click on a checkbox in the set, (and decrement when you deselect a box. When you have reached 6, you can for example set all non-selected fields to read-only, until your user has deselected one (and that variable went down).

• Define an array into which you write the return value of the checkbox, when you check the box. Control the length of that array and do as above.

• Loop through the field values of your checkboxes and count the ones which are not "Off". If you get beyond of 6 (meaning that your user attempts to activate a seventh one), set event.target.value back to "Off" (and pop up a warning that the maximum number of allowed selections has been reached).

Hope this can help.

Max Wyss.