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

Turn On "Select in Unison" for all Radio Buttons in a PDF

Community Beginner ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

Hi,

 

I have a large PDF form that has 400+ Radio Buttons. Many of these Radio Buttons are repeated and I want them to copy the prior selection. I know the property to turn on is "Buttons with the same name and choice are selected in unison". However, is there a way we can loop through the fields and turn this property on for all radio buttons in the PDF instead of going one-by-one or group-by-group?

 

Maybe something like how we change the mark type of a radio button:

this.getField().style = "styl.ch"

 

Any guidance would be appreciated, thank you!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

425

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 1 Correct answer

Community Expert , Aug 16, 2023 Aug 16, 2023

this.getField("FieldName").radiosInUnison = true;

Votes

Translate

Translate
Community Expert ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

It should be done like this:

this.getField("FieldName").style = style.ch;

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 Beginner ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

Thank you for your response. This code was just an example.

 

However, I am looking for a way to use JavaScript to turn on the "Buttons with the same name and choice are selected in unison" for all radio buttons in the document.

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 ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

this.getField("FieldName").radiosInUnison = true;

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 Beginner ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

Thank you, this worked like a charm!

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 Beginner ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

LATEST

For anyone else looking to do the same,

 

use this code:

 

for (var i = 0; i < this.numFields; i++) {
var Fld = this.getField(this.getNthFieldName(i));
if (Fld==null) continue;
if (Fld.type == "radiobutton") Fld.radiosInUnison = true;
}

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