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

Running validation script prior to allowing signature

New Here ,
Dec 18, 2020 Dec 18, 2020

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. 

Rom Project 1A1A 1A5A Blocks-2.jpg

TOPICS
PDF forms

Views

627

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

Community Expert , Dec 18, 2020 Dec 18, 2020

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

...

Votes

Translate

Translate
Community Expert ,
Dec 18, 2020 Dec 18, 2020

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.");
 
}

 

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
New Here ,
Dec 18, 2020 Dec 18, 2020

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?

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 Expert ,
Dec 18, 2020 Dec 18, 2020

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.

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
New Here ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

LATEST

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!

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