I have a form with 3 fields. All text boxes.
"YearlyTotal" - customer input field - formatted as number with $
"IncentiveLeft" - read only- formatted as number with $
"IncentiveLevel" - read only - no formatting
I tried to enter a number say 500 in the "YearlyTotal" and it should populate the "IncentiveLeft" and "IncentiveLevel" Here is my javascript code and i have tried to put it in both the calculation and validation fields of both "YearlyTotal" & "IncentiveLevel" text box properties and nothing is working. Can someone explain where i went wrong?
var yttl = this.getField("YearlyTotal"); var ilft = this.getField("IncentiveLeft"); var ilvl = this.getField("IncentiveLevel"); if (yttl.value < "500") { ilft.value = (500 - number(yttl.value)); ilvl.value = "1"; } else if (yttl.value >= "500" && yttl.value < "2000") { ilft.value = (2000 - number(yttl.value)); ilvl.value = "2"; } else if (yttl.value >= "2000" && yttl.value < "5000") { ilft.value = (5000 - number(yttl.value)); ilvl.value = "3"; } else if (yttl.value >= "5000" && yttl.value < "10000") { ilft.value = (10000 - number(yttl.value)); ilvl.value = "4"; } else if (yttl.value >= "10000" && yttl.value < "15000") { ilft.value = (15000 - number(yttl.value)); ilvl.value = "5"; } else if (yttl.value = "" { ilft.value = "" ilvl.value = "" }