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

How to hide all subForm instances (via a button's click event) except the last instance.

Avatar

Level 6

When my form is rendered, it may contain several “instances” of a full-page subForm.  So basically, I have a subForm labeled “Info” that spans a full page. According to how the form is used, when a new instance is added to the document it essentially creates new a full page.

What I’m trying to do it hide all of the instances of the subForm (“Info”) except the LAST instance which is always on the last page.

Theoretically, by hiding all of the previous subForm instances (say, 1- 4) and only keeping the last instance, it will reduce the page count from 5 to 1.

Hope this makes sense.

SO I guess I need a way to get the full subForm instance count, then hide all instances but the last instance (via a button click).

Thank you for your assitance in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 6

I belive I figured it out.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

I belive I figured it out.

Avatar

Level 2

Hi,

var sub = xfa.resolveNodes("NAME_OF_SUB_OF_INSTANCES[*]");

for( var i = 0 ; i < ( sub.length-1 ) ; i++ )

{

     sub.item(i).presence = "hidden";

}

More or less.

ZAMPAZAMPA.