2 Replies Latest reply on May 8, 2013 12:26 PM by yeungyam

    Set value of other fields, but editable

    yeungyam

      I want to automatically set values of 3 fields as soon as one of two fields are filled. However I want the user to be able to change the set value if he needs to.

      The code below works for setting the values in the 3 fields, but if one attempts to change one these 3 values, an error appears. I understand that the values of the fields should either be the set values or nothing, how can I make it editable?

       

      if((event.value != "")  || (this.getField("f").value != ""))

       

      {

      this.getField("a").value = "50";

      this.getField("b").value = "40";

      this.getField("c").value = "40";

      } else {

      this.getField("a").value = "";

      this.getField("b").value = "";

      this.getField("c").value = "";

      }