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

Need help w/ hiding all object instances

JCASE
Registered: May 12 2010
Posts: 29

using the addInstance function, I dynamically add an instance within a subform. However, when I click a button to hide the subform, it only hides the 1st instance. Not the 2nd, 3rd, 4th and so on.

Can I do this without wrapping the subform in another subform and hide the new subform.

Right now all I have is: subform.presence = "hidden"; //this hides the 1st instance, but not any additional ones I add dynamically. how can I contain all instances without wrapping in a subform.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

use a loop for this.

for (var i = 0; i < xfa.host.numPages; i++){var oSubform = xfa.resolveNode("form1.NameOfBodyPage[" + i + "]");oSubform.NameOfSubform.presence = "hidden";}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

JCASE
Registered: May 12 2010
Posts: 29
Thank you a ton. This definitely points me in the right direction, although it didn’t work right of the bat. I need to tweak it slightly. I think I can manage, but any additional help would be grateful. Here is specifically what I got:

My Form Hierarchy:

-Form1
-(Master Pages)
-Page1
-Content Area
-Page1
-item // this is the subform with instance properties
-Footer1 // This is the subform that includes a dropdown box named “Status1” with a switch(xfa.event.newText method that hides the “item” subform through the change event using javascript


The code I used, that isn’t working (still not hiding all the instances) is:

Form1.Page1.Footer1.Status1::change - (JavaScript, client)

For (var i = 0; i < xfa.host.numPages; i++)
{
var oSubform = xfa.resolveNode(“Form1.Page1[“ + i + "]”);
oSubform.item.presence = “hidden”;
}

Can you easily tell what I am doing wrong? Any additional help would be appreciated. Thanks.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You should no use names like "item" for your subforms, because Designer uses such names for other things!
Give it a more individual name such as "MyItems".
Also, your master page and body page use the same name, that's ;-/.

So, the question now is, how many instances you have of your body page and of your subform.
If the body page exists only one time and the subform "item" is repeated several times the script has to be modified into this direction:

for (var i = 0; i < xfa.host.numPages; i++){var oSubform = xfa.resolveNode(“Form1.Page1.MyItems[+ i +"]”);oSubform.presence = “hidden”;}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

shawn_loc
Registered: Mar 30 2009
Posts: 11
I've been trying to do something similar to this, with no luck. Any hints?

I have a form with the following hierarchy:

form1.p1.agenda.notes

The subform 'agenda' is repeated 3 times, with add/remove buttons at the bottom of the repeated subforms. I would like to show/hide all the instances of the field 'notes' with one checkbox at the top of the page. The code above only worked with the first instance of the repeated 'agenda' subform. I've tried throwing in the [*] wildcard, but have had no success.

for (var i = 0; i < xfa.host.numPages; i++)
{
var oSubform = xfa.resolveNode("form1.p1.agenda.notes["+ i +"]");
oSubform.presence = "hidden";
}


Any help is appreciated!