Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Form Validation On Print

Community Beginner ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

Hello,

How do I validate a PDF before the person is allowed to print it? I basically want this functionality:

https://www.youtube.com/watch?v=a_i3ZszohnI

Any assistance would be awesome!

 

I have attached the document I am working on. There is other javascript in there for the drop downs, but I cannot seem to get the ON PRINT validation working.

 

I am using Adobe Acrobat DC.

 

Thank you,

TOPICS
Create PDFs, PDF forms

Views

932

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

You have a function with the name "validateFields", but you doesn't use/call the function.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

Yes! I noticed that and fixed it, thanks! Another question, do you know how to update the javascript so each of the missing fields appear on a new line? Right not the script has them displayed with a comma.

 

I have attached up the updated working file. Try printing it as soon as you open it and you will see what I mean.

Thanks!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

Try this: app.alert('There are '+flg+' fields that require a value\n\n'+ fArr.toString().replace(/,/g, "\n"), 3);

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

Awesome! Worked like a charm. Thank you so much!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 08, 2021 Jun 08, 2021

Copy link to clipboard

Copied

Hi Jeffreyg,

Can you please recap what you did to get the script to work? I created a PDF with a print button and with required fields. My fields show the required red outline. I downloaded your PDF, and hit the print button. I got this validation message. 

Screen Shot 2021-06-08 at 2.53.32 PM.png

 

I also saw the comment from Bernd above with a new script. Where did you type in this script for it to appear before printing? (I checked the Actions tab in the buttons property dialog box andI didn't see the script to display this message.) Did you also add Bernd's script to get it to work? Can you please post?

 

I will also respond to Bernd's posting too. Thanks.
Jonathan

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 08, 2021 Jun 08, 2021

Copy link to clipboard

Copied

LATEST

Hi Bernd,
I also responded to Jeffrey's post too. I was trying to figure how Jeffrey was able to get the script to work. Here's what I posted afew minutes before:

Hi Jeffreyg,

Can you please recap what you did to get the script to work? I created a PDF with a print button and with required fields. My fields show the required red outline. I downloaded your PDF, and hit the print button. I got this validation message.

Screen Shot 2021-06-08 at 2.53.32 PM.png

I also saw the comment from above with a new script. Where did you type in this script for it to appear before printing? (I checked the Actions tab in the buttons property dialog box and I didn't see the script to display this message.) Did you also add Bernd's script to get it to work? Can you please post?


I made a script that warns people there are fields, but I still allows the person to print the form. I would like to create a form that would prevent the person from printing a form before the required fields are entered.

 

Thanks,

Jonathan

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Can you share your PDF file  as i cannot download the attached link

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines