7 Replies Latest reply on Jan 17, 2018 10:48 AM by Bernd Alheit

    Problem with calculations fields,  can you help me?


      I created the following code for the field with the number 30:

      var x = this.getField("valor_col").value;

      var y = this.getField("esc_col").value; // another field (dropdown) that receives only color names (strings)

      if (y == "red" ) {

      event.value = x + 4


      else if (y == "blue" ) {

      event.value = x + 2


      else if (y == "green" ) {

      event.value = x - 2


      else {

      event.value = x + 1


      The code is working correctly, the problem happens when I type any value in the other fields that do not yet have javascript code. For example, when I choose the blue color, my field should add 2 to the total, this actually happens, but when I type any value in any other field it adds 2 more to the value of the field that has the code I created (for example), and this should not to happen. Can you help me?