Compare a sum field against an entered field and add color if not equal
I have a form that a user enters an amount to be funded, then enters individual amounts of fundings and fees that it must equal. If the sum of the individual funds and fees does not equal the amount to be funded, I'd like to show the amount to be funded box in red to bring it to their attention.
I created a hidden field that sums the individual funds and fees ("TotalFundings").
The field the user enters the amount to be funded is ("AmountFunded")
I have a custom calculation in the ("AmountFunded") as follows:
var fund = this.getField("AmountFunded").value;
var total = this.getField("TotalFundings").value;{
if(fund == total)
event.target.fillColor = color.white;
else if (fund != total)
event.target.fillColor = color.red;
}
The only time the "AmountFunded" field is red is only when I click in the box. I'd like it to be red the entire time as amounts are entered and change to white when the amounts equal.
