Copy link to clipboard
Copied
I am trying to create a custom javascript calculation that will do the following:
Caculate: Subtract AGI_Total - (Deductions +Exemptions) and the result would go into the Taxable_Income field
I can do this in the Simplified Field notation of the Taxable_Income field on the PDF form I am working on but what I am having trouble doing is if the sum equals a negative number, I want the Taxable_Income field to display 0. Unfortunately, I am very new at Javascript and I don't know how exactly to do this. I am using Adobe Acrobat Pro.
Can someone help please?
Use this code as the field's custom calculation script:
var result = Number(this.getField("AGI_Total").value) - (Number(this.getField("Deductions").value) + Number(this.getField("Exemptions").value));
if (result<0) result = 0;
event.value = result;
Copy link to clipboard
Copied
Use this code as the field's custom calculation script:
var result = Number(this.getField("AGI_Total").value) - (Number(this.getField("Deductions").value) + Number(this.getField("Exemptions").value));
if (result<0) result = 0;
event.value = result;
Copy link to clipboard
Copied
It works! Thank you! and thank you for the speedy response!