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

Creating Instance of Subform inside a Subform

svsatishkumar
Registered: Nov 21 2007
Posts: 25
Answered

Hi,

subform1
--------------subform2
---------------TextField1

This is the subform structure i have in my table.
I created one instance for the root subform and to the root subform i created two the child subform subform2.The two child subform added to the root subform correctly.
when i create another instance of root subform and try to create an instance on the child subform it is added to the first instance of the root subform and not to the instance created lastly.

How to add the instance to the recently created instance.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Are you talking about doing this dynamically at runtime using JavaScript? or in Designer, when you are first setting up the form?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

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

svsatishkumar
Registered: Nov 21 2007
Posts: 25
At runtime only.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ok, what code are you using to create the child subform instance? Are you properly referencing the 2nd subform at the root level?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

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

svsatishkumar
Registered: Nov 21 2007
Posts: 25
yes. subform1.subform2.instanceManager.addInstance(1);
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ahh, if "subform1" is the repeated subform at the root level, then to add a new instance of "subform2" to the 2nd instance of "subform1", you would need to use this code.

resolveNode("subform1[1].subform2").instanceManager.addInstance();

The input to "addInstance()" is a boolean value for connecting the subform with the data model, it is not an instance index.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

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

svsatishkumar
Registered: Nov 21 2007
Posts: 25
yes you are right.that is working.
Thanks a lot for you support and quick response
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Could you please mark the post as "answered"

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