I want to user to use print button on the form not on the adobe menu? How can I disable and pass error message every time user click the print button from adobe menu? using JavaScript for Xfa forms that are developed in LiveCycle.

1 Answers

0
Cold_Class On

A workaround would be to check for a variable in the prePrint event, that you only fill when clicking the button. So if the user clicks on the menu the variable won't be filled and you can cancel the print process and show an error msg.

So for example in the prePrint event:

//Set a variable (buttonClicked) to true prior in the `click` event of your print button
if(!buttonClicked) {//if the menu print was used cancel and show error
  xfa.event.cancelAction = 1; //Prevent printing
  xfa.host.messageBox("This is a message", "This is a title", 3, 1);
}

What I usually do is calling any function I need in the prePrint event, this way it doesn't matter if the user clicks on the adobe menu print or not. And in case I want to print a specific way, I first cancel the print action and then print programtically with the parameters I need.