2 Replies Latest reply on Jun 1, 2015 12:06 AM by yahooshua

    Loops are buggy in Acrobat... or is it just me?

    yahooshua

      I've had a few issues with loops while working in Acrobat. Is it just me?

       

      My current issue is that when my loop is in the code for a button, the code after the loop doesn't work. When I comment it out it's just fine except I need the output from the loop.

       

      Here is my loop:

      I have 88 text fields pap1, pap2, pap3... pap88.

      Often there is no input until "pap40", sometimes there is input in "pap1".

      I want the first input value "papStart" and the last "papEnd" when I press the button.

       

      var papStart =0,
           papEnd = 0;
      
      for (var papRow = 1; papRow < 88; papRow += 1) {
          if (this.getField("pap" + papRow).value > 1){
          var papValue = this.getField("pap" + papRow).value;
              papEnd = papValue;
              if (papStart === 0) {
                  papStart = papValue;
              }
          }
      }
      

       

      When I run this in the debugger I get this error:

      TypeError: this.getField("pap" + papRow) is null
      2:Console:Exec
      

       

      Thank you for your help with this. It's driving me CRAZY. I've tried a few different things.