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

Instance Manager Help

wsterli
Registered: Jun 27 2008
Posts: 14
Answered

Hello,

I am designing a travel form that details a
travel itinerary for our clients. Our clients do
not always have typical itineraries so I'd like our
form to be flexible enough to acommodate any
combination of legs in a trip.

I've created each travel category in its own subform (flight, car, hotel, etc.).
I’ve created a button for each instance to repeat with
the following script assigned to the “Click” event for each button.

_hotel.insertInstance(1);
_flight.insertInstance(1);
_car.insertInstance(1);

Currenty, each new instance appears grouped
with the same category of instance.

Example:

Flight
Flight
Flight
Rental Car
Rental Car
Rental Car

I'd like to be able to create any order of instances

Example:

Flight
Rental Car
Flight
Rental Car
Hotel

Is there a way to do this?

Thanks.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
To actually move instances around like this (intermixing them) within the document structure is a bit awkward and probably dangerous.

A better way to do it would be to place all of your repeated subforms into a single parent subform.
The repeat this parent subform instead of repeating the individual entries (flight, rental, and hotel). Make all of the contained subforms "hidden", and only make one of them visible when a new instance is added.

You'd have buttons like "new Flight" "New Rental", that create the new parent and set the presence for the correct subform.

Hope this helps,
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

wsterli
Registered: Jun 27 2008
Posts: 14
Thank you! That's a much better solution.

I have a couple more questions.

Where should I specify the "hidden" code? In the LiveCycle
Object . Field palette, initialize event, Form:Ready event, etc.?

[i]and . . .[/i]

How do you specify the SOM of the object (flight, hotel, etc.) I
want to reveal in each repeating subform?

This is the code I have assigned to the [b]addflight[/b] button
using the [b]click[/b] event which doesn't seem to work.

_legSubform.insertInstance(1);addflight.presence = "visible";

[i]Note: [b]legsubform[/b] is the subform containing flight,
hotel, car subforms.[/i] is the button assigned

Again, thank you for your response.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I'm not sure what you mean by "Hidden" code. But I assume you mean the code that sets which subform is visible in "legsubform"? You'd do this in the button code.

Assuming the "addflight" button is at the same hirearchy level, or lower, as the "legSubform". The code in the button would be
var newLeg = _legSubform.insertInstance(1);newLeg.flightSubform.presense = "visible";

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

wsterli
Registered: Jun 27 2008
Posts: 14
Sorry about that.

I meant to ask: where do you specify the "hidden" presence code for the flightSubform?

I have it set within the Object palette but it doesn't
become visible when I click the button.

Thanks again for your quick response.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I'm still not sure what you mean. All of the flight, car, etc. subfrom should initially have thier presence set to "hidden", which is done on the "Object > Subform" tab in Designer. There is no place in the object tab for entering code? When one of the buttons is clicked, a new "legSubform" instance is created and the proper "car, flight,etc." subform is made visible with the code I showed above.If it's not working correctly then maybe there is an issue somewhere. For example, is the form saved as Dynamic? Is the "Language" on the button script set to "JavaScript"? Are all the subform names spelled correctly in the code (JavaScript is case sensitive)? Do any errors appear in the Console Window?

Have you seen the esemninar video that explains many of these concepts at:

https://admin.adobe.acrobat.com/_a200985228/p87746471/

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