2 Replies Latest reply on Jun 26, 2009 7:16 PM by Ramon F Herrera

    Loop through fields missing fields?




      I have a simple loop that iterates through each field in a multi-page PDF.  This seems to work fine, but I notice in some cases manages to skip fields that I know are legimitately there.  This PDF resides on a webserver, and some fields are actually created dynamically via button clicks, etc. - using a form submit and FDFToolkit "listener" script injection on the server.  This all works fine.  I thought the nature in which I'm dynamically creating these fields (var f = this.addField...) was the reason why they're not apparent during my loop, but I noticed that when I dynamically create 6 identical text fields for instance - 3 are found in the loop and 3 are not.  Seems like it misses every other field. Additionally - regular old form fields on the PDF from the get go are missed - I have 2 similar buttons with different names and the loop only grabs one.  So strange!  Any help would be greatly appreciated!  Here is my basic loop structure FYI:




      var fieldName = "";
      for (var i = 0; i<this.numFields; i++)
        fieldName = this.getNthFieldName(i);
        console.println("Found Field: " + fieldName);
        //do something

        • 1. Re: Loop through fields missing fields?
          try67 MVP & Adobe Community Professional

          Make sure you're not changing the value of i anywhere else inside your loop...

          • 2. Re: Loop through fields missing fields?
            Ramon F Herrera Level 1

            Hi Kyle:


            I have an uncorroborated suspicion that in documents that are somewhat crowded (with many JavaScript-based fields) some of the clicks may get lost, and the document becomes less responsive. It would be helpful if some of the readers can confirm/deny this.


            I have a multiversion example in which, as the document becomes more complex, I have to click several times until the click is processed. Simpler versions don't miss a beat.


            This seems to be a case of:


            (a) Having to migrate our code to SDK-based native code for performance reasons.




            (b) Perhaps there is a bug in the JavaScript platform.


            I am using the traditional Acroforms.


            Good luck!