2 Replies Latest reply on Jul 14, 2014 1:13 PM by ftrevor

    Having issues with populating a Text Field with data from 2 other fields

    ftrevor


      I have 3 fields Tools_1a_pri, Tools_1a_pri_other, Tools_1a_pri_txt.

       

      Tools_1a_pri is a drop down combo with a predefined list. One of the options is "Other".  When "Other" is selected, the text field Tools_1a_pri_other becomes visible for users to enter the name of the other tool.

       

      The Tools_1a_pri_txt is a text field with a calculation that shows either text stating that no tool has been selected or the Tools_1a_pri & or Tools_1a_pri_other.

       

      When I select one of the predefined tools, everything works.  When I select other, it appears that nothing has changed.  It requires that I click on another field before it populates.  This is confusing to the user.

       

      Tools_1a_pri   Validate code
      this.getField("Tools_1a_pri_Other").display = event.value=="Other" ? display.visible : display.hidden;

       

       

      Tools_1a_pri_txt  Calculation code
      //if nothing is selected, do the following
      if (getField("Tools_1a_pri").value.length < 2) {
      event.target.textColor = color.red
      event.value = "No primary tool identified";
      }else if (getField("Tools_1a_pri").value != "Other") {
      //otherwise do this if other is selected
      event.target.textColor = color.black
      event.value = getField("Tools_1a_pri").value;
      }else if (getField("Tools_1a_pri").value = "Other") {
      //otherwise do this if other is not selected
      event.target.textColor = color.black
      event.value = getField("Tools_1a_pri").value + " - " + getField("Tools_1a_pri_Other").value;
      }