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.

Hiding an Object on the Master Page

Avatar

Former Community Member
I'm searching for an answer to a problem: how do you hide an object that's located on the master page of a form??



I have a text field on the master page of my form that displays a predefined string value. I would like to hide this text object (or remove the value) when the form is printed but have the object and/or text re-displayed afterwards. I've tried the following solutions with no success:



- Setting the presence of the object to invisible in the prePrint event and setting the presence back to visible using the postPrint.



- Setting the font color to white in the prePrint event and setting the font color back to black using the postPrint.



- Setting the value of the object to an empty string in the prePrint event and setting the value back to the predefined string value using the postPrint event.



- Setting the relevant property of the object to "-print" in the XML source of the form.



My LiveCycle and javascript knowledge is fairly limited so I'm not sure if I'm approaching this in the wrong way. Any help would be much appreciated...
9 Replies

Avatar

Former Community Member
Have you tried changing the presence of the field? You can run a search for "Changing the presence of a form design object" in your Designer Help, there are scripting samples in there to help you. The only catch is that you have to save the form as a dynamic form in order to change the presence of an object. You should be able to make the object invisible in the click event of your print button.

Avatar

Former Community Member
David,



I've tried changing the presence of the field with no success. Changing the presence to invisible worked fine when the object was located on a body page but when I moved the object to the form's master page, the script no longer worked. BTW, I'm running the script from the field object's prePrint and postPrint events and not from a button click event.



I'm still scratching my head over this one...

Avatar

Former Community Member
Make sure you're saving your PDF as a dynamic PDF and not a static PDF.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Chris,



The form has already been saved as a dynamic PDF since there are repeating subforms in its design. Maybe I'm referencing the object incorrectly. Right now the field on the master page is using



>this.presence = "invisible";



and



>this.presence = "visible";



in the corresponding prePrint and postPrint events...

Avatar

Former Community Member
The script looks fine. Here's a quick sample that does this. Maybe it will help you figure out what's different between this and yours.



Chris

Adobe Enteprise Developer Support

Avatar

Former Community Member
OK now I'm even more confused...I've done exactly the same thing as you did in the sample form but to no avail. So on a whim, I cut and pasted the text field from the sample into my form and lo and behold, it worked! I have no clue why but I'm just glad it did. I hope I don't run into this problem in the future...could it be some sort of glitch?

Avatar

Level 4

What was the trick to this?  I'm having the same issue....I want to hide my subform using the prePrint and postPrint event on the master page and it's not working, but it works on the body page.  My form is dynamic and my script is this.presence = "hidden";

Thanks

Avatar

Level 4
hi, I need this solution too

my email

alecam@email.it

thank's

Avatar

Level 6

Hello,

Please try this and fins the attached sample for the same.

write the script in TOP level of the form.

---form1::prePrint - (JavaScript, both)----

form1.Page1.TextField1.presence = "hidden";

form1::postPrint - (JavaScript, both)

form1.Page1.TextField1.presence = "visible";

save as dynamic pdf.

Thanks,

Raghu.