Copy link to clipboard
Copied
I am creating a form in Acrobat Pro DC and I am trying to run a validation script to ensure two text boxes show equal numerical values prior to allowing a signature. The bottom "Hours" text box in the "This O&A Cost Estimate is being provided for the following:" is formatted to sum up the hours in the 7 lines above. I am try to add a validation alert that will pop up if the hours block a the bottom of the "labor" table does not match the other "Hours" total when the "Originator" goes to sign the document. This is the JS I added to the "Originator" signature.
if (TotalTaskHOURS.rawValue != TotalManHours.rawValue){
app.alert("Total hours and Labor hours do not match.");
}
I attempted to sign the document with the different totals in the two "Hours" text boxes and the app alert did not pop.
It shouldn't let you sign if the values of the total hours are different.
this.resetForm() takes care of that part.
Are you referring to prevent the "Save As" dialogue from executing when the user clicks on the signature field to sign it? Or, better yet, to immediately trigger the alert without allowing the Save As action to execute?
If the document is allowing to sign even when both total hours fields are different recheck the script to see if something was mistyped. That is not happeni
...Copy link to clipboard
Copied
You're using the wrong syntax.
Seems like you've exported a LiveCycle Designer form to Adobe Acrobat. If it had any scripts, be aware that Acrobat JavaScript is different.
You need to employ a mouse-up event script in the "Originator" signature field like this:
if (this.getField("TotalTaskHOURS").value != this.getField("TotalManHours").value) {
this.resetForm(["Originator"]);
app.alert("Total hours and Labor hours do not match.");
}
Copy link to clipboard
Copied
Thank you very much for the response! That script worked and popped the JavaScript alert window, but after multiple attempts trying: Mouse-Up, Mouse-Down, On Focus, On Blur, everytime the alert popped after I signed the document. Is there a way to restrict the signature until the alert window pops and is ackowledged?
Copy link to clipboard
Copied
It shouldn't let you sign if the values of the total hours are different.
this.resetForm() takes care of that part.
Are you referring to prevent the "Save As" dialogue from executing when the user clicks on the signature field to sign it? Or, better yet, to immediately trigger the alert without allowing the Save As action to execute?
If the document is allowing to sign even when both total hours fields are different recheck the script to see if something was mistyped. That is not happening on my end.
Copy link to clipboard
Copied
That was it, thank you! I went back and reviewed the code and realized you had a different capitalization on the "TotalManHours" field than I had. Corrected mine and it work like a charm!