Expand my Community achievements bar.

Check required forms before printing

Avatar

Level 2

Hallo all,

I'm creating an few forms with some required fields in it. If the form is totally completed the user must print it and place an signature at the bottom.

I've found an script that's working pretty good on the folowing link. http://forums.adobe.com/message/2789460

the only problem with that script is that i need to fill in all the field that are required.

The other script I found does check all the required fields, but is for sending the form to an e-mail address or web address.

http://forums.adobe.com/thread/606762?tstart=0

Does anybody know how I can solve this problem?

Greeting,

Timo

6 Replies

Avatar

Level 10

Here is a sample that is designed for Acrobat/Reader v9, as it uses validationState and cancelAction properties:

https://acrobat.com/#d=bcDWf-2ivJqSG6okADt4ZA

Hope that helps,

Niall

Avatar

Level 2

It works very good in your example PDF, but in my pdf I put in in the right place, but I can print with empty required boxes.

Must I have Livecycle Designer ES2.5 for this?

Greeting,

Timo

Avatar

Level 10

Hi, just an addition to Niall's sample,

check out this post from Stefan Cameron how to prevent printing with the validation element.

http://forms.stefcameron.com/2008/04/13/prevent-printing-pdf-forms-in-acrobat-8/

Avatar

Level 2

Thanks that script works! I forgot the change the name from "form1" to "formulier1".

And like you said. The cancel command is only working in adobe reader 9.

Thanks for it!

Avatar

Level 2

Hi all,

I'm back in this topic because the users from the form are using different versions of adobe reader. The script is not working properly on other versions.

Is it possible that my script will be edited that you get the pop-ups to show you that you forget to fill in some required field, but that the print job will not be canceled.

this is my script:

// run the form validation in prePrint, if Control+P or printed from menu

// if validation fails, then cancelAction will prevent printing

if

(formulier1.execValidate() == false)

{

xfa.event.cancelAction

= true; // cancel printing

}

else

{

xfa.event.cancelAction

= false; // proceed with printing

}

Greetings,

Timo

Avatar

Level 10

Hi Timo,

Thee are a few threads (even recently), which highlights a bug in Acrobat X version 10.0.0. This caused the cancelAction to fail/hang.

See:

http://forums.adobe.com/thread/902748?tstart=0 and all of the links in the thread.

I have tested our solution again in Acrobat X version 10.1.0 and it works.

Overall the solution is a bit limited, as it only works in Acrobat/Reader in versions 9.1 and 10.1.0. It does not in versions v9.0 and below OR in v10.0.0.

I suspose you need to consider if there is a risk that the user could be using a version where it wont work. If so they follow Radzamr's advice and refer to Stefan Cameron's post: http://forms.stefcameron.com/2008/04/13/prevent-printing-pdf-forms-in-acrobat-8/.

Good luck,

Niall