3 Replies Latest reply on Mar 12, 2015 1:07 PM by try67

    Continuously get a value in order to autofill a text box.

    niah37410507

      I am creating a type of KPI scoreboard that will tell the user what type of level they are currently operating in depending how they respond to four questions.  I have set it up so that:

      Column 1 = Strongly Disagree = 0

      Column 2 = Disagree = 1

      Column 3 = Agree = 2

      Column 4 = Strongly Agree = 3

      I figured out how to calculate the sum of the check marks which shows up instantaneously.  My problem is that the Level Description associated with each sum does not continuously update like the sum does.

      When the sum is 0 "Not Started" shows:

      Screen Shot 2015-03-12 at 2.44.05 PM.png

      But when I change the box selection, the sum changes but the words don't:

      Screen Shot 2015-03-12 at 2.44.16 PM.png

      Not until I go back into Properties and re-run the JavaScript does it change:

      Screen Shot 2015-03-12 at 2.44.33 PM.png

      Here is my current code:

      // custom variable name for the level description

      // establish the name of the sum field

      var cSum = 'EESUM';

      // get the value of the sum field

      var nSum = this.getField(cSum).value;

      // set level description

      if(nSum == 0) event.value = "Not Started";

      else if((nSum > 0) && (nSum <= 4)) event.value = "Beginning";

      else if((nSum > 4) && (nSum <= 6)) event.value = "Learning";

      else if((nSum > 6) && (nSum <= 8)) event.value = "Performing";

      else if((nSum > 8) && (nSum <= 11)) event.value = "Achieving";

      else if(nSum == 12) event.value = "Excelling";

      // end of script

       

      Please help me find a way to continuously update the text box.  Is a while loop needed?