These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Add Pages dynamically

DanielKunz
Registered: Jan 22 2008
Posts: 55
Answered

Hi,

I have created a form where I can choose some productareas.
When I choose one area a list of articles ist grow up in subform instances.
When I choose a second area the old subform instance list grows up with the new list of articles (no new instance list).

Now I want to open every productarea in a new page to have a better overview.

my old structure is like this:
PAGE --> LIST --> ROW (addInstance)

my new structure should look like this:
PAGE (addInstance) --> LIST --> ROW (addInstance)

I tried that code but nothing happend:
----------------------------------------------------------------------------
var sSubformSOM = "PAGE";
var oSubform = xfa.resolveNode(sSubformSOM);
var sParentSOM = oSubform.parent.somExpression;
var sManagerSOM = sParentSOM + "._" + oSubform.name;
var oManager = xfa.resolveNode(sManagerSOM);
var nSubCount = oManager.count;

var oNewInstance = oManager.addInstance(1);
----------------------------------------------------------------------------

My questions now are:
- how can I add a new page dynamically ?
- how can I adress that new pages to add my row instances?

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
On the surface your code looks fine. So I can't say exactly what the problem is. But here are some things to try.

1. Is the page subform and the parent set up properly to be dynamic?
2. It's not necesssary to create new instances of the page subform to get new pages. All you need to do is create page size subforms within a page and if the parent subform is setup correctly, it will grow into new pages. Any element, like your row instances, that you want to manipulate must already be on the repeated subform.

Remember, Dynamic live cycle forms don't have a solid concept of pages. The subforms labeled as pages are only there as a convenience. Really, any subform can expand to cover several pages. and still be the same subform.

3. Test out your code from the console window using absolute references to the subforms you want to create new instances of. It's possible that you are making small errors. You can get a much better handle on all that's going on by developing your code from the console window.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

scottsheck
Registered: May 3 2007
Posts: 138
Daniel,

And I assume you've saved your form as a Dynamic file
DanielKunz
Registered: Jan 22 2008
Posts: 55
I found the problem.
Of course it was a small mistake.
I forgot the stupid small checkmark for repeat the subform on PAGE.

Thanks for all your help!

@thomp: your idea without the instances of the page subform was good, but I don't think it work in my form.
For that there must be the same size of subforms on every page I thought.
But I have different sizes on every page.

Never mind, my form works now perfectly. Thanks!