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

Working with addInstance


Not applicable
I have worked with adding more instances of subForms but only adding more to the end.

How do I add an instance after a certain subForm?

For example, if I have 6 instances of a subForm and I want to insert another instance of the subForm after number 3 how do I do it?

Or can it be done?
6 Replies


Not applicable
Hi Steven, you just need to change your current position for the addition:

var oSubform = this.resolveNode("Subform2");

var oNewInstance = oSubform.instanceManager.addInstance(1);

var nIndexFrom = oNewInstance.index;

var nIndexTo = this.parent.index + 1;

// Invoke the instanceManager to insert the subform below the current one.

oSubform.instanceManager.moveInstance(nIndexFrom, nIndexTo);


Not applicable

Thanks for the quick response. I tried the code you sent and it does add a new instance the subForm but not in the way I was expecting. Here is what my subForm is made of.

The subForm called "imageInfo" is 744 points wide by 36 point tall and consists of several text field next to each other. There are two button on the left side. One that deletes the subForm and one that I want the user to click and it will add a new blank subform below it.

When I tried the code a copy of the bottom most subForm was added to the bottom.


Not applicable
As I have been playing around with this it looks like what is happening is when a new instance of the subForm in added and put in the right place it assumes values of the check boxes from the subForm that was in that position previously. They can't be unchecked. At least that is what is happening in Preview mode.

It looks like they just have the appearance of being checked but really aren't. I'm just guessing at this point but it seems like that is what is happening. I have noticed that when it get to the point where a so many new instances are added so a new page is added then the check boxes that have the appearance of being checked are no longer checked. Strange.

I suppose I could post the form if anyone is interested in seeing how it is working.


Not applicable
Hi Designer Experts,

Im getting in very similar troubles to those faced in July 2005 ( I tried different ways to make the addInstance method work, without any success. Just like pmhsilva, I dont see the method addInstance in the code completion feature, but Im using a brand new download of designer (version 7, 0, 041126). More surprisingly, should I write addInstance or addInstances, nothing happens, I dont even get an error message; what is type after instanceManager. seems just to be ignored (same trouble with setInstance for example)! Should the method be manually registered in one or another way ?

Could you help me solve it ?

Tx !



Not applicable

Make sure that you save your form as a dynamic PDF. For examples of using the instanceManager see


Adobe Enterprise Support


Not applicable
Thanks Denver,

my form was saved as dynamic PDF. But... the subform container type was set to "positionned content", so each new instance was over the previous one, giving the impression of no change! Once the type was set to "Flow Content", everything worked fine! -but I still have no automatic completion after ".instanceManager" -OK it doesn't matter as it works! It really worth paying attention at complete characteristics of the examples, not only the code.