7 Replies Latest reply on Mar 20, 2016 12:03 PM by Onsightclimb

    Text fields and number 0 problem

    Onsightclimb

      Hello.

      I have very wierd problem and I hope, that somebody could help me.

      I have group of 7 checkboxes, named "group". Each checkbox has his own export value. (-3, -2, -1, 0, 1, 2, 3). Then I have one text field, named "polje" where selected value is displayed. If user select check box with export value 3....text field showing number 3 and so on. I get this with this script:

      getField("polje").value = this.getField("group").value;

       

      So far everything works perfect. Now...problem. I have another textfield, named "procent". His mission is to show additional text by specific value.

      If  field "polje" showing value 1, textfield "procent" must display "30%", if value is 2 then "60%"....and so on. Everything works fine...only with value 0...then textfield stay empty but it should display "0%". I dont know why.

      Script I use:

       

      var p = this.getField("polje").value;

       

      if (p == "") {

          event.value = "";

      }

      else if (p == 0) {

          event.value = "(0%)";

      }

      else if (p == 1) {

          event.value = "(30-40%)";

      }

      else if (p == 2) {

          event.value = "(60-70%)";

      }

      else if (p == 3) {

          event.value = "(90-100%)";

      }

      else if (p == -1) {

          event.value = "(-30-40%)";

      }

      else if (p == -2) {

          event.value = "(-60-70%)";

      }

      else if (p == -3) {

          event.value = "(-90-100%)";

      }

       

      Where I do something wrong?