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

Code to Check Required Fields before Printing

publicdebter
Registered: Feb 20 2008
Posts: 18
Answered

Hello All,

I would like to create a custom print button that runs code to check required fields, and only prints the form if certain fields are filled out.

Can anyone provide this code and where on the form it should be placed?

I am not very script savvy and am relatively new to LC.

Thanks!

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This can be done. You'll need to download the XML Forms Object Reference. this is pretty much the JavaScript Reference for LiveCycle Designer. In it you'll find the "xfa.host.print" function and examples on how to use it.

In LiveCycle, required fields have a property called "mandatory" that is set to the value "error". You'll need to find and loop over all the field that have this setting.

What you are asking for is custom code development. It's possible that someone has already has already written this script, but unlikely they'll just paste it up here, or that it will do exactly what you want. You should spend some time to learn how to the scripting you'll need on your form.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

publicdebter
Registered: Feb 20 2008
Posts: 18
Thanks Thomp!