Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Using a drop down list to make a subform become visible/invisible

Avatar

Level 2

I am trying to do something simple... I just cant get it to work. I have a drop down list named "ownership" (Which is part of, DOES THE BORROWER HAVE AN OWNERSHIP INTEREST IN ANY OTHER PROPERTY? and I have choices "Y" and "N". When the user selects "Y" I want the subform (which is currently invisible) named "sometimesHidden" to appear. Then if the user selects "N" after they have already selected "Y" I want it to disappear. It is a blank form with neither Y/N as a default, just blank. It should just appear.. it does not need to move any thing.. just appear and disappear.

Capture.JPG

I have been trying to get it to work on the "Exit" mode in JavaScript for the drop down. I have tried to utilize other examples and nothing. Any help?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 4

I got it to work by changing the save options from a static PDF to a Dynamic PDF. I am not a very decent coder so I just went into the Action Builder and created a show and hide Action on that section and it worked great. If I left it as a static PDF the show/hide code and Action never worked. Once I saved it as a Dynamic PDF it worked great.

View solution in original post

7 Replies

Avatar

Level 7

Your code for the exit event should look something like this.

if (this.rawValue = "y") sometimesHidden.presence = "visible";

else sometimesHidden.presence = "invisible";

What do you have now?

Avatar

Level 2

I inserted the statement just as you have it and I still get nothing. I made sure to have it on Javascript and Exit and my initial subform is invisible. Maybe I am missing a setting?

Avatar

Level 7

Appologies. I was in a hurry and didn't check my code.

if (this.rawValue == "Y") sometimesHidden.presence = "visible";

else sometimesHidden.presence = "invisible";

I would also make sure your properties on the dropdown are set to commit on "select" rather than on "exit", but that's personal preference.

Avatar

Level 2

I am sorry I am still getting nothing... here is a link to the document in my dropbox. Maybe this will help

https://www.dropbox.com/s/tyx92c34sxc6087/HE%20Loan%20Worksheet.pdf

Avatar

Level 7

You've checked the box for "Specify Item Values." If you want to use that, then the rawValues for Y and N are 1 and 2, respectively. Or you can uncheck the box and the original code should work.

I notice that almost ALL of the fields are invisible when I previewed the document on my PC. I'm presuming that there's a reason for that, but haven't gone on to investigate.

Avatar

Correct answer by
Level 4

I got it to work by changing the save options from a static PDF to a Dynamic PDF. I am not a very decent coder so I just went into the Action Builder and created a show and hide Action on that section and it worked great. If I left it as a static PDF the show/hide code and Action never worked. Once I saved it as a Dynamic PDF it worked great.

Avatar

Level 2

Thank you both for your Help! Jasotastic81, you pushed me in the right direction and even taught me a few things! Josh, when I saved it as a Dynamic it worked instantly! Thanks again