Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do you set multiple check boxes so that at least two of them must be selected?

New Here ,
Feb 02, 2016 Feb 02, 2016

A client has a section on their PDF which has three check boxes, and they need it set so that only one or two of the three options can be selected before finalising the document. The problem they're facing is that when people fill out the form, they tick all three when they're only supposed to select one or two. I know there's a way to link check boxes so that at least one of them is required, but setting two of them has me stumped. I'm guessing something would need to happen where the third remaining check box can't be checked, or some type of warning would appear. Is anything like this even possible?

Any help would be appreciated.

TOPICS
Acrobat SDK and JavaScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Feb 03, 2016 Feb 03, 2016

Hi malaga‌,

Please check the check box properties & the logic set on the checkboxes.

KB documents for help :-

Regards,
Aadesh

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 03, 2016 Feb 03, 2016
LATEST

Thanks Aadesh. I've almost got it, this is the JavaScript I have applied to each check box:

if (getField("Box1").value=="Yes")
if (getField("Box2").value=="Yes")
if (getField("Box3").value=="Yes")
(getField("Box1").value = getField("Box1").value=="")
(getField("Box2").value = getField("Box2").value=="")
(getField("Box3").value = getField("Box3").value=="")

The only issue I'm facing with this is that selecting all three check boxes does not immediately deselect all of them, it only deselects the last one clicked and one of the other two, leaving a third one selected. Is there a way to tweak this code so that selecting all three check boxes will deselect them all, meaning only two can ever be selected at one time?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines