Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Trouble changing visibility of a subform...

Avatar

Former Community Member
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

Avatar

Former Community Member
lok at the hierarchy view and path your way to the subform. For example:



form1.Page1.subform1.presence = "invisible"

Avatar

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

Avatar

Former Community Member
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")

Avatar

Former Community Member
If you look at the javascript console do you see any errors reported?

Avatar

Former Community Member
>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.

Avatar

Former Community Member
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.

Avatar

Former Community Member
Email sent, I couldn't get that to generate errors even when the app spit out an error...

Avatar

Former Community Member
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!

Avatar

Former Community Member
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.

Avatar

Former Community Member
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.