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

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

Community Beginner ,
Aug 16, 2023 Aug 16, 2023

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
702
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

correct answers 1 Correct answer

Community Expert , Aug 16, 2023 Aug 16, 2023

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

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

It should be done like this:

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

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

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.

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

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

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

Thank you, this worked like a charm!

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

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