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

Using "this.external" throws "InvalidGetError" when file is digitally signed

Community Beginner ,
Sep 14, 2021 Sep 14, 2021

Copy link to clipboard

Copied

Hey guys, I've got a bit of a weird bug that is driving me completely insane.

 

I have a form that checks if PDF is being opened in something other than Acrobat using "if(this.external){"

Until recently, this worked perfectly. If the form was opened in Chrome or something else, an error would pop up and the form fields would stay hidden.

However, sometime between July and now, this stopped working, but only when the forms are digitally signed.

 

Reproduction:

1) Document-level script executes "if(this.external){//unhide form fields}" on document open.

2) User fills form and uses digital signature field to sign.

3) User emails form to my team.

4) My team opens the form and "//unhide form fields" doesn't execute, with this error in the console:

"InvalidGetError: Get not possible, invalid or unknown.

Doc.external:3:Document-Level:zOpenDoc"

 

In my testing, I found that removing the "this.external" check would also result in an error when the script got to the "this.delay = true" line, however "this.dirty = false" works fine.

 

I'm beyond frustrated and confused dealing with this. Is this a genuine bug with Acrobat or is this a coding error on my part?

I would greatly appreciate any help that points me in the right direction.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

497

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 ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

You need to ask the developers of the Chrome PDF plugin... It has nothing to do with Adobe.

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 Beginner ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

Apologies for being unclear.

 

The issue is happening in Adobe Acrobat  Professional DC version 21.005.20060

 

Chrome is the reason that I need the code. 

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 ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

Does you get the error when you open the form in Adobe Acrobat?

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 ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

Also, post your full code, please.

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 Beginner ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

if(this.external){
    app.alert({
        cMsg: "This form does not work in your chosen PDF viewer. Please use Adobe Reader or Adobe Acrobat.",
        nIcon: 0,
        nType: 0,
        cTitle: "Bad PDF Viewer"});
} else { //Unlock the Status field and process
    this.delay = true;

    actionSetVis("Show"); //Function that adjusts visibility of form fields

    getField("Status").readonly = false;
    switchStatus();
    if(getField("Admin.Customize") == null & & getField("Admin.Save") != null){this.removeField("Admin.Save");}
    this.delay = false;
    this.dirty = false;
};

Here's the code in the script zDocOpen. It should execute on document open. When digitally signed, it fails. 

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 ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

What's throwing the error is not the usage of the external property. It's you trying to change the visibility of fields, which is not allowed in a signed document.

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 Beginner ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

I just tested that and that does not seem to be the case.
The attached file unhides a field On Open and then hides again On Save. Signed or not, it does not appear to throw any errors. 

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 ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

If you don't lock the fields with the signature then you can edit them, yes, but your code does a bunch of other things, too, and one of them might not be allowed...

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 Beginner ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

Additional note: Changing "this.external" to "false" causes a different error:

 

GeneralError: Operation failed.
Doc.delay:10:Document-Level:zDocOpen

 

Which is related to the "this.delay = true"

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 ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

You can't set the external property as false. It's a read-only property.

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 Beginner ,
Sep 15, 2021 Sep 15, 2021

Copy link to clipboard

Copied

LATEST

Let me rephrase. In the above code, if you remove "this.external" and replace it with "false" so it skips the IF statement, then you get the error listed.

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