Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to get only the first level of nodes for a subform?

Avatar

Level 2

How can we get only the first level of nodes of a subform?

For ex:

Form1

     SubForm1

          Text1

          Text2

          RadioButton1

     SubForm2

          Text1

          Text2

          RadioButton1

     SubForm3

          Text1

          Text2

               SubForm31

                    RadioButton1

In this heirarchy if we give Form1.nodes will refer to all nodes under the Form1 (SubForm1,Test1,Text2,RadioButton1,SubForm2,...SubForm31, RadioButton1 etc..)

But is there any way that we can access only the first level of nodes of Form1 ie can we get only (SubForm1,SubForm2,SubForm3) for Form1 in any Way..?

Thanks.

1 Reply

Avatar

Former Community Member

Two ways .....

1. Use Javascript E4X instead ...there are nice functions for getting children of parents.

2. Cycle through all of the form1.nodes and look for objects that have a className of "subform". For loops are useful for this task.

Make sense?

Paul