PDF Form JavaScript Conditional Formula
I'm trying to have a field only calculate if there the information in another field is greater than 0. I've tried a few different formulas but haven't been able to get it to work.
This is the current formula without the condition that works but is calculating all the time (vs just when the one field is above 0):
TuitionAmountBeforetheCOF + StateTABooKAllowance + MandatoryFees -CollegeOpportunityFundAmountONLY - PellGrantAmountAwardedForSemester - AdditionalFundingSourceAmount1 - AdditionalFundingSourceAmount2 – AdditionalFundingSourceAmount3
This the conditional attempt:
var PellGrantAmountAwardedForSemester = this.getField("PellGrantAmountAwardedForSemester").value
var TuitionAmountBeforetheCOF = this.getField("TuitionAmountBeforetheCOF").value
var StateTABooKAllowance = this.getField("StateTABooKAllowance").value
var MandatoryFees = this.getField("MandatoryFees").value
var CollegeOpportunityFundAmountONLY = this.getField("CollegeOpportunityFundAmountONLY").value
var AdditionalFundingSourceAmount1 = this.getField("AdditionalFundingSourceAmount1").value
var AdditionalFundingSourceAmount2 = this.getField("AdditionalFundingSourceAmount2").value
var AdditionalFundingSourceAmount2 = this.getField("AdditionalFundingSourceAmount2").value;
if(PellGrantAmountAwardedForSemester >= 0) event.value =( (TuitionAmountBeforetheCOF + StateTABooKAllowance + MandatoryFees - CollegeOpportunityFundAmountONLY - PellGrantAmountAwardedForSemester - AdditionalFundingSourceAmount1 - AdditionalFundingSourceAmount2 - AdditionalFundingSourceAmount3));