Expand my Community achievements bar.

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

How to reorder / move new pages and subform instances

Avatar

Level 1

I have a form that has 2 functions - show a hidden page and duplicate the Page 1 and I need to reorder the pages once the user has added an instance or shown a page. I have Form A (Page 1) that can be duplicated but the user can add in a Form C (extra page) to be attached at the end of that instance of Form A.  So it goes like this:

Form A (Page 1)

button 1 - Adds new page 2 "Form C" to end of that "Form A"


if (CompleteFormC.rawValue == 1) then


   topmostSubform.FormC2.presence = "visible"


   xfa.host.pageDown();


else


   topmostSubform.FormC2.presence = "hidden"


endif


button 2: Adds a new instance of "Form A"


topmostSubform.FormA.instanceManager.addInstance(1);


xfa.host.pageUp();


Currently, it adds the Form C to the very end, like so:

  1. Form A
  2. Form A
  3. Form A
  4. Form C
  5. Form C
  6. Form C

I am trying to reorder the pages so the user can add in a Form C to every instance of Form A, like so:

  1. Form A
  2. Form C
  3. Form A
  4. Form C
  5. Form A
  6. Form C

It's a little complicated but I would appreciate any help at all!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

you can't swap rows / instances between different objects..

If you want to have Form A and Form C right after, you must have Form A and Form C in the same page, so when you add instances they will always be together.

All you need to do is show or hide the Form C when it is needed...

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

you can't swap rows / instances between different objects..

If you want to have Form A and Form C right after, you must have Form A and Form C in the same page, so when you add instances they will always be together.

All you need to do is show or hide the Form C when it is needed...

Avatar

Level 1

Ahh, thank you. I just moved Form C into Form A subform group, it works and stays attached to that instance of Form A. Here's another issue... now that I have Form C appended to Form A, when I add in another Form A it correctly gets added after the last Form C but how can I get the form focus to go to the top of that new instance of Form A?

Currently I am using: xfa.host.pageDown()


But now it would be skipping down a few pages. Is there a way to also move to the top of that new instance?


Thanks!

Avatar

Level 10

Hi, to be able to switch to the right page you can also use this:

to focus on a specific page go like this: