I have a section of a form that requires you to check "RateComparison" or "MultiLocation". Depending on which box is checked, the "Lodging" line will be filled.
Here is the written version of my goal:
If "RateComparision" is checked, then "Lodging" is equal to the lowest value of "TripTotal1", "TripTotal2", and "TripTotal3".
If "MultiLocation" is checked, then the "Lodging" is equal to "GrandTotal".
And... here is the nightmare of a code I've created. *Note: RateComparison and MultiLocation are both under CheckBox "Group1"
var a = this.getField("TripTotal1").value;
var b = this.getField("TripTotal2").value;
var c = this.getField("TripTotal3").value;
var d = this.getField("CheckOne").value;
var e = Math.min(a, b, c);
if (d === "On" && this.getField("TotalTrips") > 0) {this.getField("TotalBacktoTravelRequest").value = e; }
if (d === "Off" && this.getField("TotalTrips") > 0) {this.getField("TotalBacktoTravelRequest").value = this.getField("TotalTrips").value; }
if (this.getField("TotalTrips").value === 0) {this.getField("TotalBacktoTravelRequest").value = 0; }
Thanks for any help!