Copy link to clipboard
Copied
Good day,
I created a loan monthly payment calculation PDF with the following fields;
- Current year: "_cYear" (a script adds in this value automatically.
- Vehicle year: "_vYear" (this value is entered by the user).
- Vehicle age: "_vAge" (this is calculated my simple script subtracting Current year from Vehicle year).
-Vehicle price: "_vPrice (this value is entered by the user).
- Term: "_term" (this value is the number of monthly payments, its value is selected based on the age of the vehicle using "if/else" function).
- Interest rate: "_iRate" (this value is fixed).
- Downpayment: "_dPayment" (this value is 15% of the Vehicle price).
- Loan Amount: "_lAmount" (this value is the Vehicle price minus the downpayment).
-Monthly payment: "_mPayment" (this value is the result of the formula).
I get the desired results, however, I will like to include a button that will open a pop-up window that shows the following statement;
if the vehicle is 7 years or less in age;
"('_mPayment'/month, '_term' months, No Downpayment - FCIB)"
Or, if the vehicle is 8 years to 10 years in age;
"('_mPayment'/month, '_term' months, '_dPayment' Downpayment - FCIB)"
Or, if the vehicle is 11 years and older in age;
"(This vehicle does NOT qualify for financing)"
Is this possible?
K. Gibbs.
Code for PopUp menu:
var age = this.getField("_vAge").value;
var pay = this.getField("_mPayment").value;
var dpay = this.getField("_dPayment").value;
var term = this.getField("_term").value;
if(age <= 7){
app.alert(pay+"/month, "+term+"months, "+"No Downpayment - FCIB",3);}
else if(age >=8 && age <=10){
app.alert(pay+"/month, "+term+"months, "+dpay+" Downpayment - FCIB",3);}
else if(age >= 11){
app.alert("(This vehicle does NOT qualify for financing)",3);}
Copy link to clipboard
Copied
For a simple popup, you can use the app.alert() method: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJ...
If you want something more complex, take a look at the execDialog method: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJ...
Copy link to clipboard
Copied
Code for PopUp menu:
var age = this.getField("_vAge").value;
var pay = this.getField("_mPayment").value;
var dpay = this.getField("_dPayment").value;
var term = this.getField("_term").value;
if(age <= 7){
app.alert(pay+"/month, "+term+"months, "+"No Downpayment - FCIB",3);}
else if(age >=8 && age <=10){
app.alert(pay+"/month, "+term+"months, "+dpay+" Downpayment - FCIB",3);}
else if(age >= 11){
app.alert("(This vehicle does NOT qualify for financing)",3);}
Copy link to clipboard
Copied
Perfect!
Worked like a charm.
Much thanks Nesa!