Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Help regarding the Print button

Avatar

Level 9

Hello All ,

I have got a form which has 7 pages. There is a print button in the first page.The 'Print' button should allow a user to print the form to a,local or network printer, as long as the required fields are input. How to do this ? If I click on the Print option it only shows the Adobe PDF printer.

Thanks.

Bibhu.

16 Replies

Avatar

Level 10

Hi Bibhu,

You can do a form validation in an if statement and if that passes, then allow printing.

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

Hope that helps,

Niall

Avatar

Level 7

Hi Niall,

what is: Sign collection1 in the Heriarchy under Variables for the sample you have post?

Regards

Theodoros

Avatar

Level 10

Hi Theodoros,

The example was part of another issue with digital signatures.

The signCollection1 is the collection of objects on the form that will be locked when a digital signature is applied to the 'sign here' field.

When you drag a digital signature object onto the form, there are additional settings in the Object > Signature tab. This includes the option to have new collections or manage existing collections.

Parallels Desktop1.png

The collection appears in the hierarchy, but is not editable there.

Good luck,

Niall

Avatar

Level 7

Thanks Niall as always with your detail explanations..

We learn so much from you!

THANK SO MUCH

Avatar

Level 9

Hello Niall ,

Thanks for the form. I have a submit my email button also. The purpose of the button is : If the user attempts to submit the form without filling the form entries which are mandatory or leaving some form entries which are mandatory, then it should display a message box / alert. The alert should specify the page number and the field name which are left blank but mandatory . Now , what the problem is there are many fields which becomes mandatory only if certain selection are made. For ex : If we click checkbox then TextField - 1 should become mandatory . So how to do that ? I am really confused.

Thanks.

Bibhu.

Avatar

Level 9

Hello Niall,

I just made the script in the Print button. But even if I fill all those required fields, it shows the alert that Please fill the required fields first.

Thanks,

Bibhu.

Avatar

Level 10

Hi,

Having the submit button give the page number as well as the field that has failed validation is getting increasingly complex to script. If all of your users have Acrobat/Reader v9.1, then you could use the new validateState event and the new validation handling features of LC Designer ES2.

Here is an example of email submit for Acrobat/Reader v9.1: https://acrobat.com/#d=W72hKORXoOt0CAeKEJUuqQ

If you or your users are likely to be using Acrobat/Reader v9.0 or below, then here is a similar example: https://acrobat.com/#d=M3oe*KTVPuco6zeZoMg6Vg. It still has functionality, but has more script to achieve it.

You should also have a look at John Brinkman's blog which has some excellent examples of validation scripting: http://blogs.adobe.com/formfeed/2008/11/validation_patterns_part_3.html

The execValidation script will check all fields that are mandatory, even those set to mandatory by the checkboxes. Here is an example for changing the mandatory property using a dropdown: https://acrobat.com/#d=dQgzjM1hQAz6dX3vtlS87w.

I hope that helps,

Niall

Avatar

Level 10

Hi Bibhu,

Can you download the latest version of the example: https://acrobat.com/#d=bcDWf-2ivJqSG6okADt4ZA, as I added script to deal with users printing via the menu or by pressing Control+P.

Our experience here is that if the mandatory fields are filled in then there is no error message and the form goes straight to the print dialog. The error only appears if a mandatory field is not filled in.

Can you check your script and when previewing use the Javascript console (Control+J) to check for errors.

Niall

Avatar

Level 9

Hello Niall,

I have pressed Control+P without filling any fields, but it got printed. The JavaScript console is not showing any kind of errors.

But I have some issues with the previous form. As I have many required fields in a form and I have set the empty message in the value tab of the object tab to show the Page number and the field description , it shows a weird message like this.

Fields.JPG

How to get it over with ? I have 8 Pages. And there are many required fields. If I will write script for every fields then it will be really cumbersome and it will show alert after alert to the user , if the user has forgotten to enter more than one field.

Thanks.

Bibhu.

Avatar

Level 10

Hi Bibhu,

When copying the script into your form, you need to check the references. My examples have a "form1" root node. If your form's root node has a different name then you would need to amend the script to suit.

Also, in the working example all of the script is in the print button (click event, prePrint event and postPrint event). I do not think that you need to script every object at all.

I have sent you a pm.

Niall

Avatar

Level 9

Hello Niall.

I have the parent node as form1, same as yours. Let me clarify my questions once again.There are 8 pages in my form.There are nearly 10-15 required fields in each page(excluding dependant required fields).When the user clicks either the print/submit button , it should say that which field is incomplete in which page of the form.If the user has left out 3 fields in Page -1 . It should say : TextField-1,2,3 are blank in Page 1. Similar cases with other sections as well.How to implement it in the best way.I need the print function should execute only due to clicking.Scripting for ctrl+p not required here by me .

Thanks.

Bibhu.

Avatar

Level 10

Hi Bibhu,

From above:

You could build a custom error message, probably inside a function, to look through the form and add suitable text strings to form the error message. However I think that this is going to be overly complicated. The standard form validation colours the failed fields red (v9 or below) or blue (v9.1). I would expect a user to be able to go through the eight pages and deal with the failed fields in turn. Providing the page numbers in the message will not necessarily make it easier for the user, because as soon as they have cleared the message, the information is gone.

I would be inclined to run with the built-in validation processes in Acrobat/Reader v9 and below (failed fields highlighted in red). You could supplement this with a message that the user should review the fields highlighted in red and to provide a response to these fields.

I hope that helps,

Niall

Avatar

Level 9

Hello Niall,

I was also exactly thinking the same.But I do not know why, even if I fill all the mandatory fields and then clicking the submit button it shows all required fields have not filled yet. I am confused. It's really difficult to work on a form which is designed by someone else.

Thanks.

Bibhu.

Avatar

Level 10

Can you share the form?

The examples work, so you should be able to replicate in your form.

Niall

Avatar

Level 9

Hello Niall,

I am really sorry. I am not allowed to share the form . As it will violate the client's policy . Ohh God !!! I am trapped.

Thanks.

Bibhu

Avatar

Level 10

Hmmm,

Without seeing the form, it is difficult to determine what is going wrong. Maybe as radzmar suggested in another thread, you may have a hidden/invisible object that is also set to mandatory.

I would recommend that you take the validation approach back to its simplest and not try to build a custom message (field names and page numbers). When you get the basic validation working, you can then start to increase the functionality.

Niall