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

Instance Manager not working with Hidden Subform

br27ke
Registered: Nov 12 2009
Posts: 21
Answered

I have a form that starts out with one page. This page has checkboxes to make other pages (subforms) change from hidden to visible. This all works correctly. The subform I want to turn is a repeatable subform with a checkbox to add instance. This works correctly if the subform is originally visible, but when I make it originally hidden and turn it on, nothing happens when I click the add Instance checkbox.

Here's the code on the original checkbox to turn the subform on (on the change event)
if (this.rawValue == 1) {
Form.sf5.presence = "visible"
}
else if (this.rawValue == 0) {
Form.sf5.presence = "hidden"
}

And here's what I currently have on the click event of the subform checkbox
if (this.rawValue == 1) {
Form._sf5.addInstance(1)
}
else if (this.rawValue == 0) {
Form._sf5.removeInstance(1)
}

Any ideas/suggestions would be appreciated - Thanks!

wgillespie24
Registered: Jul 9 2010
Posts: 5
I had an issue with 2 hidden subforms that resided within a single cell of a repeating table. I needed Radio Buttons (SheetRoll[0] and (SheetRoll[1]) to toggle the presence of "SheetSize" subform or "RollSize" subform to visible or hidden. It only work correctly on instance [0]. On all other instances, the Radio Buttons would only toggle instance[0].

I fixed this my placing the Radio Buttons within the same (subform cell) as the "SheetSize" subform and "RollSize" subform.

I'm not sure about your code (i'm a beginner at code)..... but that's how i fixed my challenge with repeating tables that contained hidden subforms.
wgillespie24
Registered: Jul 9 2010
Posts: 5
I tested your code and got the same results. Maybe the default preference of sf5 being "hidden" was overriding your checkbox change event for making sf5 "visible". So it may have been adding an instance, but the instance it was adding was hidden.....? not sure, but I'm still trying to wrap my brain around all this javascript stuff.

When I re-created your challenge, I came up with this solution:
- changed the object preference of sf5 to "visible"
- add this code to the form:ready event: Form.sf5.presence = "hidden"

I also noticed on my test form, clicking the original checkbox to show/hide sf5 would only hide the last instance (leaving all prior instances still on the page). You may want to put code for the original check box that would hide or remove all instances of sf5.
br27ke
Registered: Nov 12 2009
Posts: 21
I did get this work using the form:ready event as you described. I still have the issue that if I want to turn off the original checkbox, it only turns off the first instance. But at least I know the workaround for this. Thanks for your help!