Popup and required field

Community Beginner ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

Hi. I need to insert a popup message when a user not to fill out a required text field.
I don't know javascript...
Someone can help me?
Thank you

TOPICS
Create PDFs, JavaScript, PDF forms

Views

243

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

correct answers 1 Correct Answer

Most Valuable Participant , Mar 23, 2021 Mar 23, 2021
Remove the space between the back-slashes and the double-quotes (") characters.

Likes

Translate

Translate
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

What should trigger this pop-up to appear? You have to use an event, not a non-event...

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 ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

My pdf has a lot of fields, but only one must be mandatory.
If the user does not fill in this field, when saving the file, the popup must show: required field.
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
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

OK, but be aware that won't prevent the user from saving the file.

What's the name of that field?

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 ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

Ok, i doesn't matter if you can save anyway. The important thing is that you see the alert.

The field is called: Data di trasferimento

Thanks again!

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
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

OK, go to Tools - JavaScript - Set Document Actions and under the Document Will Save event add the following code:

 

var f = this.getField("Data di trasferimento");
if (f.valueAsString==f.defaultValue) app.alert("You need to fill in \"Data di trasferimento\"!",1);

 

(You can adjust the text of the message to whatever you want it to be, of course)

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 ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

Sorry... it says:

SyntaxError: missing ) after argument list

2: to the line 3

screen.png

 

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
Most Valuable Participant ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

Remove the space between the back-slashes and the double-quotes (") characters.

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 ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

LATEST

Great! It works!

Many many thanks!

Ciao!

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