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

How to make different group check boxes in PDF forms

New Here ,
Feb 15, 2024 Feb 15, 2024

Copy link to clipboard

Copied

Hi everyone,

 

In PDF Forms I am struggling with adding some checkboxes and I've included an example. 

I want people to only choose the option 'Yes' or 'No', so I gave the checkbox the same name with a different export value, but I want the checkbox 'Name' and 'Adress' only to be clickable when the checkbox for 'Yes' is checked, so that you cannot check the box for 'No' and check the box 'Adress' at the same time. 

Thanks!

TOPICS
How to , PDF , PDF forms

Views

394

Translate

Translate

Report

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

correct answers 2 Correct answers

Community Expert , Feb 15, 2024 Feb 15, 2024

There are a couple of things that would create this effect. 

1. Add a script to the MouseUp of the Yes and No buttons that will set the readonly propertly of the address box.

2. Add a "Show/Hide a field" action to the MouseUp of the Yes and No buttons. 

 

The second option will work on more platforms because it doesn't use a script. #1 will only on PDF viewers that support scripting.   But neither will work in all cases. 

 

 

 

Votes

Translate

Translate
Community Expert , Feb 15, 2024 Feb 15, 2024

Hi,

 

I would recommend you change the Yes/No checkboxes to be a radio button group, as in this group only one field can have a value, so either the yes or no can only be clicked, if one is clicked it clears the value from the other one.

 

You can add a JavaScript on each of the radio buttons that shows/hides the other checkboxes, making so that they cannot be filled in if you radio buttons are not clicked correctly.

 

```

this.getField("Check Box2").display = display.visible;
this.getField("Chec

...

Votes

Translate

Translate
Community Expert ,
Feb 15, 2024 Feb 15, 2024

Copy link to clipboard

Copied

There are a couple of things that would create this effect. 

1. Add a script to the MouseUp of the Yes and No buttons that will set the readonly propertly of the address box.

2. Add a "Show/Hide a field" action to the MouseUp of the Yes and No buttons. 

 

The second option will work on more platforms because it doesn't use a script. #1 will only on PDF viewers that support scripting.   But neither will work in all cases. 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 15, 2024 Feb 15, 2024

Copy link to clipboard

Copied

LATEST

Hi,

 

I would recommend you change the Yes/No checkboxes to be a radio button group, as in this group only one field can have a value, so either the yes or no can only be clicked, if one is clicked it clears the value from the other one.

 

You can add a JavaScript on each of the radio buttons that shows/hides the other checkboxes, making so that they cannot be filled in if you radio buttons are not clicked correctly.

 

```

this.getField("Check Box2").display = display.visible;
this.getField("Check Box3").display = display.visible;

```

for when you want to be able to click the checkboxes and

```

this.getField("Check Box2").display = display.hidden;
this.getField("Check Box3").display = display.hidden;

```

Obviously you need to change the names of the fields.

 

Hope this helps

 

Votes

Translate

Translate

Report

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