Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

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