7 Replies Latest reply on Dec 5, 2017 8:49 AM by Thom Parker

    Help with javascript to calculate many fields




      I need help with my java code. I got a form with 3 columns with 160 text fields in each column. They are named A1.0.0-A1.15.9, B1.0.0-B1.15.9, C1.0.0-C1.15.9.


      What i want to do is take (value of) B1.x.x - C1.x.x and if the difference is more then 1.0 and less then 1.9 i want to give a message to controll that number.

      So far i got this code:

      (function calculate() { 

          var fieldNumber = event.target.name.replace("A", ""); 

          var v1 = +this.getField("B"+fieldNumber).value; 

          var v2 = +this.getField("C"+fieldNumber).value;

          var v3 = v1 - v2;

      event.value = v3;     


      else if ((v3 >= 1.0) && (v3 <= 1.9)) {

      app.alert = ("controll this");


      else {

      event.value = "";



      I get a syntex error on row 9, what did i miss? My idea is to call on this function in the calculate tab in the A.x.x column. Please help a novice thats trying to learn java