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

How do you get an Alert Message to appear before the print dialog box?

Michael Frommer
Registered: Apr 3 2009
Posts: 80

See example form at [url]http://www.nyc.gov/html/dca/downloads/pdf/new_online_form.pdf[/url].
Click on the print icon or print button and you will see what I would like to accomplish for my form.

Currently, the validation alert message for my form appears after the print dialog box appears and you click OK. I would like it to appear before the print dialog box, as it does for this [url=http://www.nyc.gov/html/dca/downloads/pdf/new_online_form.pdf]example form[/url].

Can someone tell me how to to accomplish this?

My Product Information:
Acrobat Pro 8.0, Windows
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Michael,

Since you've got a working example file- the code for the alert prior to prinying in that form can be found by selecting the "Master Pages" in the Hierarchy window and viewing the scripts in the script editor window.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
Michael Frommer
Registered: Apr 3 2009
Posts: 80
Dimitri,

Actually I do not have a working example. This is something I found on the web and thought was a great aspect to incorporate into my code, if I could.

You are oviously referring to LiveCycle. Unfortunately mine is an AcroForm. Any chance this can be done on an AcroForm?
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Michael,

If you can view the form in a browser then you do have it- just save it to your computer then open in the appropriate program. Since that is a LCD form you would need to open it in LiveCycle Designer to view the code- that is what I did. If you have Acrobat 8 Pro then you also have LiveCycle Designer- they come in the same box ( purchase).

If you need to see what application a PDF was orignally created open it in Acrobat and look under Document Properties- in this case it shows the form was created in Designer 7.

Yes, you can do this in Acrobat for an AcroForm with changes to the code.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
Michael Frommer
Registered: Apr 3 2009
Posts: 80
Thanks. I hadnt occurred to me to do that.

I believe I found the applicable code, but I'm not sure how to translate it for an AcroForm. I've never used LiveDesigner before.

I've deleted lines that I am positive are irelevant. I think some of what is remaining (shown here) is also irrelevant, but I guess it's a mute point since I dont know how to translate the code for an AcroForm.


----- LicenseApplication::prePrint - (JavaScript, client) ------------------------------------------  // ------------------------------------------------------------------function lookNodes(currentNodes){var oNodes = currentNodes.nodesvar nNodesLength = oNodes.length;for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount ++){showNode(oNodes.item(nNodeCount));if(oNodes.item(nNodeCount).nodes.length > 0 ){lookNodes(oNodes.item(nNodeCount));}}}// ------------------------------------------------------------------lookNodes(xfa.form); // ------------------------------------------------------------------  if (vRequiredFieldsNotFilledFlag != true){if (Utilities.CheckStock() == false) {xfa.form.LicenseApplication.Page1.presence = "invisible";xfa.form.LicenseApplication.Page2.presence = "invisible";xfa.form.LicenseApplication.Page3.presence = "invisible";xfa.form.LicenseApplication.Page4.presence = "invisible";xfa.form.LicenseApplication.Page5.presence = "invisible";xfa.host.messageBox("The stock ownded must not exceed 100%.");xfa.host.setFocus(vCurrentNodeName);}else { vAllowPrint = true;//xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);}}else{xfa.form.LicenseApplication.Page1.presence = "invisible";xfa.form.LicenseApplication.Page2.presence = "invisible";xfa.form.LicenseApplication.Page3.presence = "invisible";xfa.form.LicenseApplication.Page4.presence = "invisible";xfa.form.LicenseApplication.Page5.presence = "invisible";xfa.host.messageBox("This document may not be printed until all mandatory fields have been correctly entered." + "\r\r" + "Please be sure to complete any of the highlighted fields on this form.");xfa.host.setFocus(vCurrentNodeName);}
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Michael,

Sorry you didn't know it was an XFA form, but at least you know how to tell them apart now. I don't write or develop code in these forums as it would take me too much time (I'm not a pro scripter by any means). Maybe someone else will jump in that could do it quicker and/or has time. It is a bit of work you're asking for though, so don't get too impatient if it takes a while or if no one is available to do that much gratis for you.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
Michael Frommer
Registered: Apr 3 2009
Posts: 80
I wasn't asking that someone do that. I realize it's not a simple matter. I just meant to thank you for pointing me in the right direction and I wanted to say that unfortunately, because I'm just starting to learn javascript for AcroForms, dealing with XFA is way too much for me at this time.

LiveCycle does look interesting though. I may have to try to use it for my next interactive form.

Thanks again.