Utilizing a pop-up to show the results of calculations

Community Beginner ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

I'm not sure how to approach this. I have a one page, can't be more than one page, client financial presentation PDF form. There is no room left on the form to add text or fields. Either by using a rado-button or check-box, once clicked, I want to perform a simple calculation comparison. When the calculations are complete, a message window will pop-up with standard text verbage with the contents of fields and variables imbedded with-in the text. So, I have two questions:

  1. Which pop-up style window would work the best, be it sticky-note, or other.

  2. How do I imbed the contents of several fields and variables with-in the text that is withing the pop-up.

 

Sample pop-up text (italized amounts represent the contents of fields or variables):

"Even though the extra $65 per month would have you debt free 8 months sooner, in reality, you would have spent an extra $10,075 in loan payments just to save $5,492 in loan interest. Do you think we can find a better use of that $65?" 

The $65 is from a field. The rest of the amounts are variables containing the results from calculations.

TOPICS
JavaScript , PDF forms

Views

38

Likes

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 , Jun 20, 2022 Jun 20, 2022

An easy method is to use the app.alert() function. Here's an article on how to use it.

https://acrobatusers.com/tutorials/popup_windows_part1/

 

You'll need write code to acquire the contents of the fields needed to build the text string, which will then be passed into the app.alert() function. 

 

In JavaScript, strings are stitched together using the "+" symbol. Like this.

 

var strHello = "Hello " + this.getField("FirstName").valueAsText;

app.alert(strHello);

 

This code adds the word "Hello"

...

Likes

Translate

Translate
Community Expert ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

An easy method is to use the app.alert() function. Here's an article on how to use it.

https://acrobatusers.com/tutorials/popup_windows_part1/

 

You'll need write code to acquire the contents of the fields needed to build the text string, which will then be passed into the app.alert() function. 

 

In JavaScript, strings are stitched together using the "+" symbol. Like this.

 

var strHello = "Hello " + this.getField("FirstName").valueAsText;

app.alert(strHello);

 

This code adds the word "Hello" to the text in the field named "FirstName". Then displays the text to the user in an alert box. 

This article might help you with some of this;

https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm

 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

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 ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

LATEST

Perfect! Thank you. Just needed some direction. Got huge brain fog from a head cold. Soon as that clears up I will try it out and let you know.

 

Likes

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