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

Add button on page 2, changes page 1

hahuhobrad
Registered: Oct 2 2008
Posts: 2

First, let me provide some details about the form. It is a weekley update that will be saved as a pdf and e-mailed; no database will be used to collect the data. The form provides information about shipments (1 form per shipment) that have a variety of information that is relevent to some shipments and not others. Also, the number of shipments may change so the number of pages is dependent variable.

The form includes a 'add form' button at the top so the user can add form pages as needed. (also has a remove page button)

Within the form is a button titled 'add SPOD' which stands for Sea Port of Debarkation. Some shipments will unload all cargo at one destination while others may have up to 3 different debarkation sites.

This is where I have the problem. When I click on 'add SPOD' on any pages that were added using the 'add form' button, it adds the 'SPOD' subform info to the first page and not to the page where the button is clicked.

Here is the script I used for the 'add form' button:

1. ----- form1.ammoform1.ammoupsub1.Header.addform::click: - (JavaScript, client) ---------------------

3. xfa.form.form1.ammoform1.ammoupsub1.instanceManager.addInstance(1);

Here is the script used for the add SPOD button:

----- ----- form1.ammoform1.ammoupsub1.Shipmentdata.control1.addspod::click: - (JavaScript, client) ------

xfa.form1.ammoform1.ammoupsub1.Shipmentdata.SPOD.instanceManager.addInstance(1);

Not sure if this helps.

A smaller problem but easier to solve I think is that I have a check box that when selected shoul open a subform with pertinent information request to that item. The check box works, however, when I open the form, everything is displayed. Meaning, the checkbox (unchecked) and the requested fields are all visible. If I check and uncheck the box, then the fields change to hidden as they should be. Here is the script:

----- form1.ammoform1.ammoupsub1.FMSsection.FMSsub.FMScb::change: - (JavaScript, client) -----------

if(this.rawValue == 1)
FMSsub1.presence = "visible"
else
FMSsub1.presence = "hidden"

Thank you!

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Which parts of the form are shown/hidden is entirely dependant on the element and subform organization of the form, and the states of these elements in the form template. for example, if a reapeated subform contains another subform. If that subform is visible in the template (the template is what you create in Designer) then it is visible when a new instance of the main subform is created.

If you require some subforms to be visible and some to be hidden depending on dynamic (runtime) information then you need to do the show/hide in code at the time a new instance of the main subform is created.

The design of an LC form can be complex, and it sounds like yours is very complex. It's impossible to know what you're specific issues are without analyzing the actual form. However, there is a way for you to get a better handle on it. Create a new form with just one important area of your form on it. The more you can break it down the better. Then add in code and test. This will allow you to debug the troubled parts without other parts (and problems) on the form interfering.

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/]http://www.adobe.com/devnet/acrobat/[/url]

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