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

insertInstance() not working


Not applicable
I have a form which can add continuation pages to several fields. I initially have all of the continuation pages presence set as "hidden" with a button/check box to add another page using insertInstance(). For some reason insertInstance() is not working. It does work fine if the pages are initially "visible". Any ideas as to why this wouldn't work? Here is the code I'm using:

var i = Page20.instanceIndex + 1;

Page20.instanceManager.insertInstance(i, 0);
2 Replies


Level 10
If the subform is hidden then it does not really exist in the layout and any reference to that object cannot be resolved. If there is at least one instance of the object then your syntax will work (like when you make it visible). There was a syntax created to communicate with the instance manager to allow you to add an instance when a base object does not exist yet. To do this use the syntax below:


The underscore (_) indiicates that you are communicating with the named subforms instance manager.


Not applicable
Thanks Paul, that helped.

I think also when you create an instance of a subform that was originally "hidden" from the layout the new instance starts out that way.

I was able to work around that by converting i to a string, creating a variable set as Concat("Page20[", i, "]"), and then setting the presence of that to "visible".

Thanks again,

Ian Hockett