Running loop to make all fields uppercase... getting an error in the console.

Explorer ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Good evening, I have created a script to spell check a very large list of medications and cancers for our company.

I have created a loop to make all the fields lowercase, before spell checking the document.... However, the fields are being made to lowercase, and then I am prompted the error: 

"InvalidSetError: Set not possible, invalid or unknown.

Field.value:22:Batch undefined:Exec"

Here is my code for the loops:

for (i = 0; i < this.numFields; i++) {

var AllFields = this.getField(this.getNthFieldName(i));

AllFields.value = AllFields.valueAsString.toLowerCase();

}

spell.addWord(items);

spell.check();

for (i = 0; i < this.numFields; i++) {

var AllFields = this.getField(this.getNthFieldName(i));

AllFields.value = AllFields.valueAsString.toUpperCase();

}

Any help would be greatly appreciated!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

117

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
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Feb 19, 2019 Feb 19, 2019
Not all field types have a value property... Specifically, button fields don't have one.So you need to add a condition in your code that checks the field's type before trying to change its value.

Likes

Translate

Translate
Adobe Community Professional ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

LATEST

Not all field types have a value property... Specifically, button fields don't have one.

So you need to add a condition in your code that checks the field's type before trying to change its value.

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
community guidelines