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

Add pages with a button

Avatar

Level 7

Hello,

I have a form that is five pages long. I have a button on page 5 that when clicked adds copies of pages 1-4. It's working, but it's adding the duplicate pages after the original page so then I have page 1, page 1, page 2, page 2, etc. What I need is page1, page2 page3, page4, then page5 then page 1, page 2, page3 page 4.

Here is the script I used and it works, just not quite what I need.

page1.instanceManager.addInstance(1);

page2.instanceManager.addInstance(1);

page3.instanceManager.addInstance(1);

page4.instanceManager.addInstance(1);

Thanks

MDawn

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Try wraping your page1 to page4 subforms in a subform and do an addInstance() on the parent subform.

Regards

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

Try wraping your page1 to page4 subforms in a subform and do an addInstance() on the parent subform.

Regards

Bruce

Avatar

Level 7

This was a great help. I appreciate your quick reply!

MDawn