Expand my Community achievements bar.

Limiting the number of check boxes to 2

Avatar

Level 1

I have a form with 15 check boxes for users to select, words to describe how a marketing piece impacts the viewer. I want to limit their selection to any 2 words how would I do this?

5 Replies

Avatar

Level 10

Hi,

By default checkboxes have a default on value of '1' and an off value '0'. This makes it fairly easy to keep track of scores using FormCalc.

Please the checkboxes in a subform and let them have the same name (in the hierarchy). Then using FormCalc you can keep track of how many have been ticked and then once this is over the limit the script sets the access property of the subform to 'readOnly'.

Example here: https://acrobat.com/#d=bkjiJETcsQVQlTVqSWhy8w

Hope that helps,

Niall

Avatar

Level 1

I get the Error: accessor 'myChoices.mediaBox[*]' is unknown

mediaBox is the common name of the boxes and the subform is MediaBoxes

Avatar

Level 10

Hi,

'myChoices' was the name of the subform in my example. If your objects have different names, then the sample script will not work. Just change 'myChoices' to your subform name, 'MediaBoxes'. So:

if (Sum(MediaBoxes.mediaBox[*]) ge 2) then

...

Niall

Avatar

Level 1

I'm getting an error this accessor 'this.access' unknown - I'm looking at your scrip now and it seems that I have it right. hm

Avatar

Level 10

Two things to check:

  1. Where have you placed the script? I had it in the layout:ready event of the subform. In this case the 'this' refers to the subform itself, eg the object that the script is in.
  2. What language have you set against the event? In my example I have used FormCalc.

Niall