6 Replies Latest reply on Nov 21, 2011 1:43 PM by try67

    What is wrong with these javascript loops?


      the 1st loop works perfect. the 2nd and 3rd fail even if ran alone they don't process thru all the information.


      the comments below are accurate as to what it does exactly the text boxes only have 7 fields of data currently but can have upto 120 entries so it does cut the array sort when ti finds the 1st blank text box. I just don't understand why loop 1 works while loop 2 and 3 fail. i will only equal 0 or 1 in the 2nd and 3rd loops.


      var ListData = new Array();
      var i;
      // Sets the list data pulled from the single line text boxes on Page 2
      for(i=0; i < 120; i++){
          ListData[i] = this.getField("DropDownData" + i).value;
              //Exits the loop early if no more data found in the text boxes
              if (ListData[i] == "") {
              i = 120;
      //Sorts the data in the array
      //purges old data from the comboboxes
      for(i = 0; i < 15; i++){
          this.getField("ItemCode." + i).clearItems();
      //Stores the data into the combo boxes
      for(i = 0; i < 15; i++){
          this.getField("ItemCode." + i).setItems(ListData);