Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Button over rides prePrint event

Avatar

Level 3

Is it possible for a button, on the click event, to over ride a prePrint event?

I have a form that on prePrint event, a page's presence is hidden, so that not even a blank page is printed.

Now I need a button that over rides that   this.presence = "hidden";  command.

Is there a tag to call out?

something like, on click event:

this.prePrint().presence = "visible";

xfa.host.print(1, "0", (xfa.host.numPages-1.toString().....

Thank you in advance

1 Accepted Solution

Avatar

Correct answer by
Level 7

I just tried it with the script below and it worked. I provided a name for the page "Page2" not sure that really matters as long as you use the correct name for the page.

if(CheckBox1.rawValue == "on"){

Page2.presence = "hidden"

}

Remember on the post print action you will need to make the page visible again:

Page2.presence = "visible"

View solution in original post

8 Replies

Avatar

Level 7

why would you have a preprint that you would need to overwrite? Do you want to reverse the hidden state after printing? If so you could do this on the post print event.

Avatar

Level 10

If you don't want an object to be printed, you can configure it in the object palette to be visible to the screen only.

Avatar

Level 7

That would work in some situations where you just do not want something to print like a button However if the situation is that you do not want to print the page if a user hasn't entered any data then it wont work.

Avatar

Level 3

Originally, the client wanted a instruction page to be screen only and completely non-printing(not even a blank page).

So I set hidden in prePrint and visible in postPrint.

Now, they are thinking that maybe there should be a button that allows the user to print the page if they really really want to.

So I though I need an override button would be the trick.

Now I'm thinking set the prePrint event with a statement.. if something is true then hidden, else visible...

and that button trigger a value then the print function.

what does everyone think? (not in the office today to try this out)

Avatar

Level 7

you could do that. You could have a hidden field with a value 0 or 1. Add a check box asking if the user wants the page printed if they click yes then the pre-print script is modified to turn on the page, else its off.

Avatar

Level 3

Well this is strange...

I placed a checkbox field on the page(that hides during print). if I check it, it should allow the page to print.

in the prePrint event for the root sub page, I wrote:

this.presence = "hidden";

if(checkbox.rawValue = "1")

{

this.presence ="visible";

}

when I click "print" without checking anything thing the page shows up.

When I look back, the check box is checked!

I tried:

if(checkbox.rawValue = "0")

{

this.presence ="hidden";

}

if(checkbox.rawValue = "1")

{

this.presence = "visible"

}

same result.

I tried with if...else

same.

It seems that Livecycle is forcing the page to be visible!

Any ideas?!

Avatar

Correct answer by
Level 7

I just tried it with the script below and it worked. I provided a name for the page "Page2" not sure that really matters as long as you use the correct name for the page.

if(CheckBox1.rawValue == "on"){

Page2.presence = "hidden"

}

Remember on the post print action you will need to make the page visible again:

Page2.presence = "visible"

Avatar

Level 3

this is why we shouldn't work late at night... syntax error

Need to remember == means equal rather than just =

mouslander, thank you for double checking!

things work as they should be. All is right with the world again.