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

Loop syntax

New Here ,
May 17, 2019 May 17, 2019

Copy link to clipboard

Copied

is there any reason this code would not work on a button?

var f = this.getField("Installation");

var a = f.getArray()

for (i=0; i < a.length; i++){

    if (a.valueAsString != null) {

        createSheet();

    }

}

I have handfull fof filelds with installation in name and i'm checking to see if any of those fields have data.

TOPICS
Acrobat SDK and JavaScript

Views

195

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 ,
May 17, 2019 May 17, 2019

Copy link to clipboard

Copied

Yes. If you access valueAsString it will never return null. If the field is empty it will return an empty string.

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
LEGEND ,
May 17, 2019 May 17, 2019

Copy link to clipboard

Copied

What event is this connected to?

What do you expect this code to do, and what does it do?

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 ,
May 17, 2019 May 17, 2019

Copy link to clipboard

Copied

LATEST

"Installation" needs to be more than just in the name. It has to be a dotted prefix.

Like this

"Installation.text1", "Installation.text2", etc

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