Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Javascript: get subform objects in a subform

Avatar

Level 2

Hello!

I have the following structure:

davids88333804_0-1594907698086.png

I would like to get all the T1 and T2 object in 2 lists.

If I use the following syntax:

var myList = xfa.form.form1.Page1.Main.nodes; to get the parent subforms

I get two types of objects: _H1 ... _HN and H1 ... HN. (_H1 ... HN objects have only get access.)

Is there a nice way to get only the H1 ... HN object so I could keep working with them to get the T1, T2 child objects?

 

Thanks and best regards.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

the _Hx are the instance of the subform. To get all the subforms (without the _stuff) you can try this

var myList = xfa.form.form1.Page1.Main.resolveNodes("#subform[*]");
app.alert(myList.item(0).name) is H1 and length of the list is 4

 

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

Hi,

the _Hx are the instance of the subform. To get all the subforms (without the _stuff) you can try this

var myList = xfa.form.form1.Page1.Main.resolveNodes("#subform[*]");
app.alert(myList.item(0).name) is H1 and length of the list is 4

 

Avatar

Level 2
Thanks for the help! Is there any documentation on ResolveNodes parameters? The documentation and examples are really simple (for example I could not find the solution that you provided). How one can come to such a great knowledge????

Avatar

Employee

by working with Livecycle and AEM Forms for over 20 years. The documentation is limited - many things you will get by experience. A lot of the original documents are not available any more (at least from Adobe) and other sources you need to watch out what you get. Here are some links that will help a little: https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/Adobe_XML_Form_Object_Model_Reference.... or https://help.adobe.com/en_US/livecycle/10.0/DesignerScriptingRef/WS92d06802c76abadb42f393e912a151d17...

or https://helpx.adobe.com/pdf/aem-forms/6-2/scripting-reference.pdf