Expand my Community achievements bar.

SOLVED

Duplicate page

Avatar

Level 2

I have a form with 7 pages but I would like to be able to duplicate page 3 & 4. be added if necessary. The principle is if form detail has only 1 person, I complete page 3 & 4, but if I need to add another person, by clicking a button, 2 new pages (copied from page 3 & 4) will be populated.

Any help is welcome.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Amanda,

To be able to duplicate a page, you will have to input one line in your xdp file and then you will be able to addInstance to the page

1. In your hierarchy, click on the page you want to duplicate

2. Once the page selected, click on XML Source

3. You should now see the beginning node of your page, insert this line inside your page node

<occur max="-1"/>

4. Now you can add instances as much as you want using

Page3.instanceManager.addInstance(1);

or

_Page3.addInstance(1);

View solution in original post

10 Replies

Avatar

Correct answer by
Level 10

Hi Amanda,

To be able to duplicate a page, you will have to input one line in your xdp file and then you will be able to addInstance to the page

1. In your hierarchy, click on the page you want to duplicate

2. Once the page selected, click on XML Source

3. You should now see the beginning node of your page, insert this line inside your page node

<occur max="-1"/>

4. Now you can add instances as much as you want using

Page3.instanceManager.addInstance(1);

or

_Page3.addInstance(1);

Avatar

Level 2

Rob

Thanks for your help, I don't have a great skills on programing. I have done points 1,2 and for point 3 I added the details straight after on the line below.

But how do you do point 4?

Thanks for your help

Avatar

Level 10

Point 1,2,3 and 4 you mean pages right? It is not different from another

I am srry if I don't understand what you mean

Avatar

Level 2

I have managed to be able to add one page with the new instance, but I need to be able to duplicate the page after as well.

see below the XML source details:

<script contentType="application/x-javascript">//+ GENERATED - DO NOT EDIT (ID:C9AF7C62-96EC-4E6D-9738-921D26D8A95D CRC:3392951709)

//+ Type: Action

//+ Result2: AddInstance("$Node3")

//+ Result1: AddInstance("$Node2")

//+ Node3: form1[0].#subform[15]

//+ Node2: form1[0].#subform[4]

//+ Node1: form1[0].#subform[15].AddSubformButton1[0]

//+ Condition1: Button("$Node1","click")

//+ ActionName: AddSubformButton1.click

  1. this.resolveNode('form1._[2]').addInstance(1);

if (xfa.host.version &lt; 8) {

    xfa.form.recalculate(1);

}

  1. this.resolveNode('form1._[3]').addInstance(1);

if (xfa.host.version &lt; 8) {

    xfa.form.recalculate(1);

}

Thanks for your help

Avatar

Level 10

You want to duplicate the data??

Because the addInstance(1) is doing exactly what you are saying, duplicate the page

Avatar

Level 2

I managed to duplicate page 3 but not page 4, if I use the add instance and select page 3 & 4 when I try only page 3 get duplicated but not page 4.

Can you help on this matter.

Thanks a lot

Avatar

Level 10

Have you also add this line in the xml source?

<occur max="-1"/>

Avatar

Level 2

Yes, I did.

Any idea, maybe to add some coding on the button to pick the 2 pages, as the instance does only pick 1.

Avatar

Level 2

I fixed it

Thanks a lot for your help. That's made my day !!!!

Avatar

Level 1

I have the same issue. Can you share your solution to duplicate 2 pages in a form?