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

InvalidSetError when trying to set value of field

New Here ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

Hello,

this is a really simple question but still I cannot see anyone with this problem.

I am only trying to set the value of a field using:

this.getField("myField").value = 3;

but I get an InvalidSetError.

However I can set the value if I use the importTextData function. So the field name is correct, it is writable but doesn't accept a value.

Thank you

TOPICS
Acrobat SDK and JavaScript , Windows

Views

178

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

Community Expert , Jan 30, 2019 Jan 30, 2019

that happens when you run this code in the console window:

this.getField("myField").value

Likes

Translate

Translate
Community Expert ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

that happens when you run this code in the console window:

this.getField("myField").value

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
New Here ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

If the field is empty, then nothing happens.

If there is a value in it, then it writes the value to the console.

Can this be caused by some sort of security or protection of the PDF file?

Thank you

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
Community Expert ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

LATEST

Yes, that's most likely the cause.

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