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

Document won’t sign with custom js Field validation

Community Beginner ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

Hey there!

I have a PDF with a signature field (created in InDesign) and custom Java Script field validation added in Acrobat. After adding the js validation code Acrobat won’t trigger the signing process when clicking the signature field, alerting me the document can’t be signed in its current form and suggests to save, re-open and sign again – which does not work.

 

This is my code – altered for demo purpose:

 

function test () {
    app.alert("Test function got called.")
    event.rc = true
}
var myFormField = this.getField("myFormField")
myFormField.setAction("Validate", "test()")

 

Removing the script let’s me sign as expected.

Am I missing some additonal steps to allow siganture fields and custom field validation to work together?

 

TOPICS
Acrobat SDK and JavaScript , Mac

Views

348

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

Advocate , Nov 03, 2022 Nov 03, 2022

By changing event handlers you change the behavior of the file being viewed from that stored on disk. Therefore, Acrobat asks you to store a version of the PDF that has the identical behavior from the start (i.e. without any JavaScript initialization necessary). Otherwise it cannot sign the current PDF (including its current behavior).

Try using the Additional Actions entry of the form field for the key V instead of JavaScript initialization of the Validate action.

Votes

Translate

Translate
Community Expert ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

Where does you use the script?

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 ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

I am adding it in Acrobat via the Java Script tool panel on the document level: "JavaScript command for documents". I am translating roughly form a german UI.

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
Advocate ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

By changing event handlers you change the behavior of the file being viewed from that stored on disk. Therefore, Acrobat asks you to store a version of the PDF that has the identical behavior from the start (i.e. without any JavaScript initialization necessary). Otherwise it cannot sign the current PDF (including its current behavior).

Try using the Additional Actions entry of the form field for the key V instead of JavaScript initialization of the Validate action.

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 ,
Nov 03, 2022 Nov 03, 2022

Copy link to clipboard

Copied

LATEST

Yeah. That’s it. Very much appreciated.

I tested both the "Additonal Actions" and the "Validation" tab. Adding custom JavaScript there, still triggers the signtaure process if I click my signature field. It is a bit more cumbersome though, since I have to manually add my code to the different form fields 😅, but hey…

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