Loop syntax

New Here ,
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

71

Likes

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

Loop syntax

New Here ,
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

72

Likes

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
May 17, 2019 0
Most Valuable Participant ,
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.

Likes

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
Reply
Loading...
May 17, 2019 1
Most Valuable Participant ,
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?

Likes

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
Reply
Loading...
May 17, 2019 0
Adobe Community Professional ,
May 17, 2019

Copy link to clipboard

Copied

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

Like this

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

Likes

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
Reply
Loading...
May 17, 2019 1