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

SOLVED

Button over rides prePrint event

shawnFMU
Level 3
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
mouslander
Correct answer by
Level 7
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

0 Replies
mouslander
Level 7
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.

radzmar
Level 10
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.

mouslander
Level 7
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.

shawnFMU
Level 3
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)

mouslander
Level 7
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.

shawnFMU
Level 3
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?!

mouslander
Correct answer by
Level 7
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

shawnFMU
Level 3
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.