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

Conditional subforms (rows of a table) hiding

watson23
Registered: Mar 25 2008
Posts: 37

Hello,
I've been designing an interactive form and towards the end of the making I started to struggle with one issue. I'll try to put it as brief as possible.
I placed a Button on a form, and below the Button there's a SubForm containing a bunch of fields. The SubForm represents a single row in a table and the fields are populated dynamically from an internal table. I'd like to hide some of the rows of this table upon a button click (rows that contain some fields that match a particular condition).
For example: once the form has been generated - it shows all goods (all rows) that are available. One of the fields (let's name it Fld_Type) says whether this particular article is a fruit or a vegetable. And with the button click I'd like to hide all the rows for which the Fld_Type value is 'vegetable').
I've been struggling with that for some time now but I haven't been able to come up with any satisfying solution... I'd be very grateful if someone could help me out with this one.
Thanks in advance
T.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Subform visibility is controlled with the "presence" property.

Here's some code that shows and hides a subform named "mySubform" based on the state of a checkbox named "myCheck"

mySubform.presence = (myCheck.rawValue?"visible":"invisible");

This will only work if the form is saved as dynamic.

This topic will be discussed at the upcomming e-seminar
http://www.acrobatusers.com/events/online/245/

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

watson23
Registered: Mar 25 2008
Posts: 37
I know how to control the visibility of subforms. My problem is how to refer to a subform created dynamically (taking into account some values of the fields this subform contains)...
Regards
T.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
use the "resolveNodes()" function to get a collection of the dynamically created subforms. The loop through them and test the fields to find the ones you want.

for example, "mySubform" is the dynamically generated subform, and assuming that the parent subform to "mySubform" has flowed content, and you'd like it to colaspe when the subforms are hidden.

var mynodes = xfa.resolveNodes("form..mySubform[*]");
for(var i=0;i

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