2 Replies Latest reply on Mar 6, 2014 6:34 AM by MatLac

    Cycling textboxes

    MatLac Level 1

      I created a bunch of textboxes which are supposed to be numbering boxes.  For example, if you fill line A, the box shows "A".  Then if you try to fill line "B", the script looks at what the last box was and assign the next letter in the alphabet, from "A" to "I".

       

      var cycleArray = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I");  //creating an array of possible choices
      var cycleLast = cycleArray.indexOf(this.getField("OPE003.P1.CYCLE").value);  //getting th value of the textbox above
      var cycleThis = ""

      if (this.getField("OPE003.2.STAT").value != this.getField("OPE003.2.STAT").defaultValue){  //if this is met, start numbering

          if (cycleLast == -1){  //if the last check box is empty (not in the array)
              event.value = "A";
          }
          else{
              event.value = cycleArray.slice(cycleLast+1);  //this is the part that doesn't work
          }
      }
      else{
          event.value = "";
      }

       

      I get that the slice() method extracts what is at the position I defined (which is the value position of the last box + 1, so basically the next item in the Array). 

       

      What is wrong with this?