I want to write a script that validates the equality of one field called "Cash 2010" with the sum of 6 other number fields. If the number entered into the "Cash 2010" field does NOT equal the sum of the other 6 fields, then I want a warning message to appear stating they must be reconciled.
I tried to write a script based on other forum postings but it does not work. Can you tell me how to rewrite this script and make it work?
(function () { // Get field values, as numbersvar a = +getField("1 to 999 Total");var b = +getField("1000 to 4999 Total");var c = +getField("5000 to 24999 Total");var d = +getField("25000 to 49999 Total");var e = +getField("50000 to 99999 Total");var f = +getField("100000 Total"); // Get the value the user entered into this field, as a numbervar g = +event.value(“Cash 2010”); if (g != (a + b + c + d + e + f)) { // Alert userapp.alert("Cash Donations in this column must be equal to the total donations listed above in the ‘Number of Donors and Gift Size Last FY’ row above. Remember to include foundation and government grants in both sections."); // Set value of field to zeroevent.value = 0;} })();
// Get the value the user entered into this field, as a number
var g = +event.value(“Cash 2010”);
to this:
var g = +event.value;