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

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

323

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 , 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.

Votes

Translate

Translate
Community Expert ,
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.

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