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

Stacking fields/Dynamic forms

Fnor
Registered: Oct 23 2008
Posts: 8
Answered

I have been working on a 2-page document, recently, where the content of the bottom half of page 2 is determined by a script attached to a combobox on page one. The perform for the combobox goes like this:

this.findOCG("set1").state = false;
...
if(this.getField("SelectBox").value == "set1"){
this.findOCG("set1").state = true;
this.showSet1();}
...

And so on for all 4 sets. I have two functions for each set, showSetX() and hideSetX(). showSetX() first calls the hideSet() for the other sets, then switches the text fields in question to visible:

function showSet1(){
this.hideSet2();
...
this.getField("Set1Box1").hidden = false;
...}

and so on, calling the other hideSet functions and switching all the fields specified to visible. hideSet is essentially the same function, except it does not call any other function, and turns the specified fields to hidden.

Under any circumstances, switching layers through findOCG works perfectly. Layers switch. When I put set boxes in areas where they don't physically overlap, everything works fine (selecting Set 1 from the box switches off all layers and then makes layer "Set1" visible, switching off all fields and makes those fields in showSet1() visible; so on for the other sets).

However, my purpose is to create the illusion of fields that are only present on certain layers (different configurations of the form), and in order to do that, the fields need to be physically overlapping, often on top of each other. Acrobat seems to have real problems with this, as no matter what the box says, it will continue to display only the fields that are "on top." if the fields "on top" are set to hidden, it will simply display neither field, even if the field "under" it is set to visible.

So, my question is, is there anything I can do to get acrobat to display my fields the way I have the javascript set up? Or does stacking them on top of each other always break the process? Is this something that would be possible in Acrobat 9? Is it possible to have a third, hidden, non-printing page full of fields and then use the javascript to move them into position before making them visible and then move them back to the hidden page after making them hidden? I am really quite lost at this point. Thanks for the help.

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
What you're describing isn't normal in my experience. What version of Acrobat are you using? What OS?

The hidden field property has been deprecated and you should use the display property instead, though this probably isn't the cause of your problem.

Is there any chance we can look at this form?

George
Fnor
Registered: Oct 23 2008
Posts: 8
Sorry, running Acrobat 8 Pro (patched CS3) on OS X 10.5.

A link to a pdf is here:
http://www.darkheavenisle.com/files/L5RSheet-3Ev2.pdf

The second page is controlled by the drop down box labelled "Position." Right now all options change the displayed layer, but only "Bushi" and "Shugenja" have associated fields. As you can see, switching from "Shugenja" to Bushi doesn't actually hide the shugenja fields, and even those that are hidden (the first column on the right under "Kata") still keep the bushi fields from displaying.

The Insight button on the bottom of page one is also doing funky stuff... it's supposed to add up all the values from the RanksX fields, but for some reason instead of adding "1" to the total (seen on the top of page one) for a "1" entered in a Ranks field, it adds "10," and if more than one is entered, "100" and "1,000." It's very strange.

Thanks for the help.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Whenever I try (using Acrobat Pro 7.1) to change the combo box, I get the following error:
TypeError: this.getField("MonkKihoName") has no properties3:Document-Level:hideMonk

Which may have something to do with your problem if it prevents subsequent code from executing.

For the last problem, you probably have an error in your code, as it may be doing string concatenation, as opposed to numerical addition.

George
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
BTW, a lot of the code you're using could be greatly simplified by taking advantage of the hierarchical naming scheme you've use for a lot of your fields. For example, to display all of the CourtierNetworkNotes fields (0-20), you can simply do this:

getField("CourtierNetworkNotes").display = display.visible;

instead of using 21 lines of code to address each field individually.

I also notice a few typos, such as:

this.getField("CourtierNetworkChampion").hiddne = false;

So I would suggest making sure that you have the debugger set up to show when an error is encountered, simplify your code a bit, and review it for typos.

George
Fnor
Registered: Oct 23 2008
Posts: 8
I thought there was a way to use the fields in batch, but did not know how. Thanks so much! That meant less code which meant less for me to look through which also meant no typos and loose ends.

Thanks again for your time and patience.