Copy link to clipboard
Copied
All, I currently have a drop down list for Amount of life insurance the customer wants to purchase called "EEVLife" and a second calculated field that calculates the cost per paycheck based on the amount of insurance and their current age. I have a third requirement to be able to be sure they can order that much life insurance and it is that they cannot purchase more than 6x their field "AnnualSalary".
This is my current code. Where do I put the qualification for the Annual Salary and how do I code it?
var age=Number(this.getField("CalculatedAge").valueAsString);
var rate=0
if (age<30) rate=0.13;
else if (age<=34) rate=0.14;
else if (age<=39) rate=0.17;
else if (age<=44) rate=0.23;
else if (age<=49) rate=0.32;
else if (age<=54) rate=0.52;
else if (age<=59) rate=0.79;
else if (age<=64) rate=1.00;
else if (age<=69) rate=1.75;
else if (age<=74) rate=3.79;
else if (age>=75) rate=10.03;
event.value=((((this.getField("EEVLife").value/1000)*rate)*12)/26)
Thank you for any help you can give.
Nancy
Copy link to clipboard
Copied
Put the script for testing the calculated amount into the custom Validation Script for the field where this calculation is happening.
var nMaxAmt = this.getField("AnnualSalary").value * 6;
if(event.value > nMaxAmt)
{
event.rc = false;
app.alert("Amount is over 6x your salary. You can't have it");
}
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Put the script for testing the calculated amount into the custom Validation Script for the field where this calculation is happening.
var nMaxAmt = this.getField("AnnualSalary").value * 6;
if(event.value > nMaxAmt)
{
event.rc = false;
app.alert("Amount is over 6x your salary. You can't have it");
}
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
You are the bomb!!! Worked perfectly! Thank you

