Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Trouble changing visibility of a subform...

Not applicable
I'm having trouble toggling the visibility of a subform.



Here's the code I stuck on a button for testing (on click):



ImageField1.presence = "invisible";

subForm1.presence = "invisible";



The Image field becomes invisible, but the subform does not...



What am I doing wrong?



Thanks in advance!
11 Replies
pguerett
Level 10
Level 10
lok at the hierarchy view and path your way to the subform. For example:



form1.Page1.subform1.presence = "invisible"
Thomas_McConnac
Level 4
Level 4
Have the subform visible in your design view, but have the cursor in the code you are typing.



Hold down the "Ctrl" key and click on the subform (or a field in the subform you want to change, can just delete the name of the field afterwards). This will give you its relative address to where you are in the code.



Tom
Not applicable
still not working...



I created a new file and here's the hierarchy:



form1

(Master Pages)

Page1

(untitled content area)

livePage

Button1

subform

(Referenced Objects)



Here's my code on the click event for Button1:



form1.livePage.subform.presence = "invisible";



I'm sure it's something simple I'm doing wrong...



Any thoughts?



oh and BTW, when I do Tom's trick and click on the subform, here's what I get:

xfa.resolveNode("form1.livePage.subform")
pguerett
Level 10
Level 10
If you look at the javascript console do you see any errors reported?
Not applicable
>Generating PDF Document...

>Font Service: Default font typeface is Myriad Pro.

>PDF generated successfully.



>0 warnings/errors reported.



I can toggle an image field in the same place, so to speak, but the subforms do nothing.
pguerett
Level 10
Level 10
Are you running Acrobat? If so when the form is rendered you can hit the Ctrl -J to see a javascript console. When you click the button if there are any errors they will appear in the console. If you do not have Acrobat, send the form to livecycle8@gmail.com and I will have a look.
Not applicable
Email sent, I couldn't get that to generate errors even when the app spit out an error...
Not applicable
I am having a similar problem. I had it working in one form. I duplicated the same way in another form and it doesn't work! I have stared at it till I was ready to fall asleep to see if I could spot the problem! No luck!
pguerett
Level 10
Level 10
Send the form that is not working to livecycle8@gmail.com and I wil have a look. Also include a description on how to duplicate the issue.
Not applicable
For anybody reading this in the future, I had my form saved as a Static PDF, which allowed toggling the visibility of some things but not subforms. Saving it as a Dynamic (XML) Form fixed the issue.



Thanks again Paul for your help sorting that out.