Error cannot be catched on this.submitForm if user is offline in Acrobat Reader.

New Here ,
Nov 24, 2020

Copy link to clipboard

Copied

I have this javascript code in PDF file:

try {
   this.submitForm({
      cURL: url,
      cCharset: "utf-8"
   });
} 
catch (e) {
   app.alert("error");
}

The "try catch" does not work if user is not connected to the network and this error appears in Adobe Acrobat Reader:

adobe-error.PNG

There are two possible solution in my head, but I don't know how to do it. I have read the documentation and could not resolve this:

Can I somehow disable(catch) this error message?

OR

Can I somehow check if the server is responding before submitting the form?

My desired behavior is to do nothing if the user is not connected to the network and send the form if user is connected.
I hope that someone helps me. Thanks.

TOPICS
PDF forms

Views

47

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Nov 24, 2020

Copy link to clipboard

Copied

1) What you tried with the try-catch clause is the only way to catch an error, but some errors can't be caught in this way.

2) Not sure that's possible, but you can maybe try the launchURL method of the app object and see if that throws a catchable error when there's no internet connection...

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
janh24215362 AUTHOR LATEST
New Here ,
Nov 24, 2020

Copy link to clipboard

Copied

Thanks for reply. However this opens a link in a browser and does not throws an error. I need something that user does not see. I need something that fetches some data from our server and check if they are valid, I tried a lot of methods from documentation and it does not work or it throws some security error.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more