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

Cancel print call...?

Avatar

Not applicable
I've designed an eForm that is intended to be filled out in Reader, printed, signed, then submitted for processing. I have a number of required fields and have created the logic (in the PrePrint event) to check that these fields are populated, generating an error message if the check fails.



However, I still need to cancel the print call if any of the required fields are not populated...can anyone help me with the Javascript to do that? (My apologies if this is a stupid question...I'm a Java newbie to the Nth degree).



Thanks in advance!

Paul
7 Replies

Avatar

Level 7
I don't believe you can prevent the user from printing, other than by

permanently blocking it.



Aandi Inston

Avatar

Not applicable
It's not that I want to prevent the print function....I need to abort the print request until all of the required fields are populated.

Avatar

Not applicable
Paul,



I would check all the required fields to see if the users had already entered all inputs. If all the required fields are filled out, you can can print the PDF. In the example below the javascript is attached to "click" event of a regular button.



Here is an example:



http://66.34.186.88/LiveCycleSamples/.3bbcbbfc.pdf

Avatar

Not applicable
Jimmypham...



Thanks for the link, but I've already got that logic working (took it from the "LoopThroughFields.xdp" sample) from the Click event on a generic button. What I'm wanting to do is call this checking function within the Print Button click event in order to have it process as one seamless event. However, IF the checking function returns at least one mandatory field that was not entered, we need to abort the print event.



Make sense? Thanks for your help!

Paul

Avatar

Level 7
I understand what you want to do. Unless Designer introduced some new

features I don't know about, you CANNOT.



An alternative strategy some people do is to have a large printable

stamp saying "Form not ready" or some such that appears only when

printing, and which you hide when the form is complete.



Aandi Inston

Avatar

Not applicable
Would it work to have your own "print" button with the editting logic in the click event and if all is well call the print function yourself?



An ugly alternative would be to display the error message, including a plea for them to cancel the print. You might also be able to make all the fields non-printing until the edits are successfully passed.

Avatar

Not applicable
Good point Tom. I thought about building my error handling logic into the Print Button, using an If/Then statement. IE, If no errors exist, then make the xfa.host.print call. Unfortunately, taking the error logic out of the PrePrint event (where it currently sits) will leave a hole if the user were to go File/Print, correct?



At the moment, the current approach throws up a message box informing the operator of the field(s) needed entry, with notification that incomplete forms will take longer to process...maybe that will be sufficient for this particular opportunity.