These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Show Confrm box before Printing

merritt
Registered: Jan 22 2008
Posts: 8

What if you wanted to display a confirmation box using AcroJS to the user each time the print button is clicked and force the user to click OK to continue printing or Cancel to cancel the print job.

We have a subset of users that need to see a special message before certain types of documents are printed. I'd like to listen for the print event, capture it, and run it through a confirmation function. Is that possible? Using "This Will Print" in Document Actions would be nice but adding an Alert here displays the message after the user selects a printer and starts the print job.

Also, is there a way to change the title of an Alert in AcroJS?

Thanks in advance for any help you can provide!

Regards,
Merritt

pddesigner
Registered: Jul 9 2006
Posts: 858
Go to Thom Parker's Javascript Corner on this site and search for his script titled - "Alert Box Examples".

Also checkout Ted Padova's "101 eForm Tips" on his blog and take a look at the title Creating Application Response Dialog Boxes

Below is the code from that page.

An application response dialog box typically presents the user with
a question and solicits an answer. Based on the response certain
actions can be invoked. You might want to ask a user how many
products to purchase. The user responds and you can then take the
data from the dialog box and add it to a field object.

To perform such a task, do the following:

* Create a text field.
* Create a button field and add the JavaScript below:

1. var t = this.getField("qty");// the target field

2. var cResponse = app.response({

3. cQuestion: "How many do you want?",

4. cTitle: "Quantity to purchase"});

5. if ( cResponse == null){ // if Cancel is selected

6. app.alert("Cancel order for this item?");

7. cResponse = 0;

8. }

9. else

10. app.alert("You ordered, \""+cResponse+"\"...items",2);//confirmation dialog

11. {

12. t.value = cResponse; // places the data from the dialog to the target field

13. }


Note: Delete the shown line numbers before using this script.

My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.