Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Move Page at runtime

Avatar

Level 2

Hi, i will create a new page at runtime. I have a form with 2 page:

form1

          P1

          P2

I make a button with this code to duplicate the page:

form1.P1.occur.max = "2";

form1.P2.occur.max = "2";

form1.P1.instanceManager.addInstance(true);

form1.P2.instanceManager.addInstance(true);

The page's order became:

     P1

     (new istance of P1)

     P2

     (new istance of P2)

but i want take this order

     P1

     P2

     (new istance of P1)

     (new istance of P2)

How can i do that?

Kind Regards.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You can do this with a subform set.  Make the subform set repeat and have it select one subform from alternatives and each repetition can then have either an occurrence of P1 or P2, you have to set P1 and P2 to repeat with a min occurrence of zero.

So to add a P1 you would do (assuming the subform set is called pages);

var pages = _Pages.addInstance();

var p1 = pages._P1.addInstance();

Here's a very basic sample. https://sites.google.com/site/livecycledesignercookbooks/home/Federico_Benini.pdf?attredirects=0&d=1

Regards

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

You can do this with a subform set.  Make the subform set repeat and have it select one subform from alternatives and each repetition can then have either an occurrence of P1 or P2, you have to set P1 and P2 to repeat with a min occurrence of zero.

So to add a P1 you would do (assuming the subform set is called pages);

var pages = _Pages.addInstance();

var p1 = pages._P1.addInstance();

Here's a very basic sample. https://sites.google.com/site/livecycledesignercookbooks/home/Federico_Benini.pdf?attredirects=0&d=1

Regards

Bruce

Avatar

Level 2

Thank you. I solved my problem.

Kind Regards.