Expand my Community achievements bar.

Dynamically rearrange pages

Avatar

Former Community Member

I'm a bit desperate I have to admit. I just want to create a nice form where the content can "grow" according to the demand of the user: Cover page, index page, followed by two pages with tables. If the user has a large dataset he should be able to duplicate those last pages and rearrange them at will.

Initially I thought it would be enough just to set up a form with the four individual pages, and let the user copy & paste single pages in Acrobat Pro. Won't work because obviously LCD forms cannot be handled by Acrobat Pro like regular PDF files (copy, delete within the thumbnail view palette).

I now found out how to duplicate pages using the instanceManager.addInstance method. I cannot, however, find a way to move whole pages up and down with JavaScript (FormCalc would be ok too).

The hierarchy of my doc:

form1

-(Master Pages)

-SFSet

--SFPage1

--SFPage2

--SFPage3 (can be cloned via addInstance)

--SFPage4 (can be cloned via addInstance)

Any ideas? Thanks so much in advance.

Mike

2 Replies

Avatar

Level 10

Hi Mike,

I haven't tried moving a page instance, but I suspect that it can be achieved with a small bit of script.

If you have a look at this example: http://bit.ly/dJAcvj, Tables 5 and 6 have arrow buttons to move rows. Table 6 is make up of a subform, so the script to move the pages will be very similar. You will just need to reference the repeating element "SFPage3" or "SFPage4".

Please note however that you will only be able to rearrange instances of an object within its own instances. You will not be able to move an instance of SFPage3 to below an instance of SFPage4.

Hope that helps,

Niall

Assure Dynamics

Avatar

Level 7

There is an approach I have used--however, it may not fit your needs here.

Instead of moving instances, you can keep an exact copy of your page hidden (scripted to get the values from the visible page) and then make it appear when needed (simultaneously hiding the existing visible page).  It mimics moving it. If you can get away with "using global data" for your field data bindings, you won't have to do any scripting for the field values.

Perhaps this, or something similar will help.

Stephen