• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

2.7K

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 Expert ,
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.

Votes

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!

Votes

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 Expert ,
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);

Votes

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!

Votes

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

 

Votes

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

Votes

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

Votes

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