Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Bizarre looping issue

Avatar

Level 1

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

0 Replies