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

Folder Level Javascript will run from Menu Item but not from Button - Need Work Around...Please help

Community Beginner ,
Aug 15, 2016 Aug 15, 2016

I have a JavaScript type script that contains a trusted function with a SOAP transaction inside of the trusted function. 

This function is inside of a folder level script. 

When I call this function from a menu item, it works great.

When I try to add and call this function from a button or from a Signature Field under the execute JavaScript when signed, it will not work and I get an error message.

What am I missing and Is there a work around, I need to run from a button or from a Signed field?

Any Ideas?

TOPICS
Acrobat SDK and JavaScript , Windows
757
Translate
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 Beginner , Aug 15, 2016 Aug 15, 2016

//  How to Run Privileged Javascript from a button

//    1.  Need to place the needed Javascript inside of a function in the Javascripts folder

//    2.  The Javascript must be a Trusted Function

//    3.  Add the call to the trusted function to the button

//

//  The Button Code for Run a Javascript on Mouse Focus is ->  Trusted_CustomCode();

//

//  The example below is a Folder Level JavaScript for Security Reasons

//

//  The example code MUST BE encapsulated in a Trusted function which is part of <cust

...
Translate
LEGEND ,
Aug 15, 2016 Aug 15, 2016

Not all menu items are available to Acrobat/Reader JavaScript for many reasons. For signatures it is a security issue and international standard that the person applying the signature can be verified each time the signature certificate is applied. This means the person applying the signature must enter his/her unique password each time the certificate is applied. Now if the user wants to share his/her password with another, then he/she must be willing to deal with the legal ramifications. Think about signing a multi-million dollar contract.

Translate
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 ,
Aug 15, 2016 Aug 15, 2016

Thank you - but your reply is not on target.

I am trying to execute a JavaScript to update a database field to show that the document has been signed.

Translate
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
LEGEND ,
Aug 15, 2016 Aug 15, 2016

ADBC, Adobe Data Base Connection, was fully removed from Acrobat in version X.

Or if you are trying to update a field after the PDF has been signed you will invalidate the signature since the digital certificate by design is to indicate if any bit of any byte in the PDF has been changed. Also you may have locked all the fields by applying the digital certificate.

Translate
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 ,
Aug 15, 2016 Aug 15, 2016

//  How to Run Privileged Javascript from a button

//    1.  Need to place the needed Javascript inside of a function in the Javascripts folder

//    2.  The Javascript must be a Trusted Function

//    3.  Add the call to the trusted function to the button

//

//  The Button Code for Run a Javascript on Mouse Focus is ->  Trusted_CustomCode();

//

//  The example below is a Folder Level JavaScript for Security Reasons

//

//  The example code MUST BE encapsulated in a Trusted function which is part of <custom_filename>.js in javascripts folder

//

var Trusted_CustomCode = app.trustedFunction(CustomCode);

function CustomCode() {

   app.beginPriv();

          

        //Custom JavaScript Code Goes Here

                  app.alert("This is my Custom Code that will run from a button");

        // End of Custom Javascript Code

  app.endPriv();

}

Translate
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
LEGEND ,
Aug 16, 2016 Aug 16, 2016
LATEST

Glad you have it working. If you have time, can you let us know what you were doing wrong? For future reference, in cases like this, you should post the code you are using (or a radically simplified test case) and most especially the exact error message.  Because... what you've posted is exactly what I'd expect you to have seen in the first case.

Translate
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