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?
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.
Copy link to clipboard
Copied
Where does you use the script?
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.
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.
Copy link to clipboard
Copied
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…