Bizarre looping issue

evan_stuckless

04-04-2018

I am encountering a very strange issue, perhaps someone can help me out with...

I have a set of nested subforms, three deep:

theContainer

     script object with function

     button

phaseForm[*]

goalForm[*]

     taskForm[*]

     taskForm[*]

goalForm[*]

     taskForm[*]

     taskForm[*]

          checkbox

phaseForm[*]... etc

I am looping through the structure with the following code in the script object:

function loopThroughStructure(){

     for (phaseCounter=0; phaseCounter<4; phaseCounter++){

          var theGoalCount = xfa.resolveNode("theContainer.phaseForm[" + phaseCounter + "].goalForm").all; 

          for (goalCounter=0; goalCounter<theGoalCount.length; goalCounter++){

               var theTaskCount = xfa.resolveNode("phaseForm[" + phaseCounter + "].goalForm[" + goalCounter + "].taskForm").all;

               //do stuff

          }

     }

}

Here's my issue. If I call the function at theContainer.button, it works fine. However, if I call the function at taskForm[*].checkbox, the loop fails if there is less than 3 instances of taskForm. Specifically it throws a xfa.resolveNode(...) is null error.

Any help would be appreciated. Thanks!

Evan Stuckless

Accepted Solutions (0)

Answers (0)