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

Setting up preSave Validations

Explorer ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

I need help.  I have scoured over countless posts/articles/how-to's, and I still can't figure this out!

I made a 6 page form with almost every field required.  It doesn't matter if they don't go in order, they just have to enter information before saving.

Fields are: text fields and radio buttons; no check boxes.

I found out that there is nothing preventing a user from saving an incomplete form.  Fine.

I found out how to make a pop-up alert when they click on a field and then click off, leaving it blank. Awesome, but ONLY if they first clicked on that field.  If they completely skip over it, not so awesome.

How do I make a message pop up when they save to ALERT them that they missed something on the WHOLE form?

In all of my research, I found stuff that points to preSave validations, but no one has ever explained the steps on going about executing this.  I have even found a post talking about executing an Action Script with a button, but it doesn't seem to work.

This form will only work if the required fields are actually ENFORCED.  Even if I have to add a button with JavaScript to enforce this message, I need someone to tell me what to do.  I've followed the steps for every other ActionScript needed, but I can't find this one.

Thanks.

TOPICS
Acrobat SDK and JavaScript

Views

412

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 Expert ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

I've developed a tool exactly for this purpose. You can it it here: Custom-made Adobe Scripts: Acrobat -- Validate Required Fields Before Printing or Saving


Basically you need to write a code that checks if all the required fields are filled in and if they're not, show an error message.

The code then needs to be placed under Tools - JavaScript - Set Document Actions - Document Will Save.

As you've found out, though, this won't prevent the file from actually saving, although if you use my tool you can force it to save as a blank copy, until all the required information is filled in.

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
Explorer ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

I will not spend money on additional software.  I've seen your sales pitch in several other posts.  I've taken to overlooking it because you're spamming the Adobe forums with this one-fix tool.  I knew I'd run the risk of having you post it on my thread.

I've specifically outlined what I need in my question.  I am aware that prevention of saving is unavailable.  I am aware there are methods on having a popup instead.  I need help with understanding how to go about achieving it IN Adobe Acrobat Pro.

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 Expert ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

I outlined how to do it in Acrobat. I've also posted code that validates all the required fields in the file on these forums, many times. You can find it if you search for it.

The tool I've developed is relevant to your question, so it's not spam. If you don't want to use it, that's fine, but don't expect others to do your work for you. And don't worry, I won't bother you again with my replies.

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
Explorer ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

I have found your code in:

https://forums.adobe.com/message/5371436#5371436

For some reason, it's not working for me.

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
Explorer ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

How do you expect people to learn all the angles of software when certain material isn't easily provided?  I was able to teach myself many other aspects of Acrobat, but extensive scripting is not something I can find all the answers to.  Hence my original posted question.

How do you expect someone to learn about something, when no one is willing to teach them?

Do you expect this person to pour over an entire XML book JUST to find the answer for ONE problem?  That's not feasible in a job order with a due date.

Do you expect this person to just quit, and let the customer go elsewhere?  That's not acceptable for a non-profit client who can't afford to pay top dollar to some programmer.  I can follow basic code; I can't easily follow extensive code, and that is what I'm apparently needing help with.

I have found numerous things, but nothing works.  I have followed your directions in the link above, but for some reason, it does not work with me.  So my initial question remains: Will somebody help me figure this out?

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 Expert ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

All the information you need is available online, for free. There are multiple code examples, complete API references and numerous tutorials on this subject. You can learn it all for yourself and do it, just like all the other people who did if before you. Of course, it takes time and effort. If you don't have the time or are unwilling to make the effort (especially if you're doing it for a job and have a deadline) then you need to hire someone else to do it for you, someone who spent the time and effort required and learned how to do it.

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
Explorer ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

That's just it.  I  have over 20 tabs open right now with various steps on achieving what I need (or supposedly achieving).  I've manage to teach myself a whole lot of other basic scripting for Acrobat, but this is something I can't seem to find that applies to me.

The only thing that seems to work is the onblur script warning the user about leaving the field empty.  I've tried the script you offered someone else; for some reason it didn't work and I even tried adjusting it to fit my form.  I've tried the "Document Will Save" Document Actions according to the other things I've found, and they don't have any messages that pop up either.  The only time I can successfully get a message popup for the entire form is if I distributed it.

I've always been under the impression that I don't HAVE to finalize the form through Distribute.  It's simply going to be a file put on the laptops of my client's Field Employees, and upon every Site they visit they will have to open and fill it according to that Site, then save it on their laptop.

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
Explorer ,
Apr 12, 2018 Apr 12, 2018

Copy link to clipboard

Copied

I have figured out the method for which I need and I'm working on it.  If I have further questions, I'll start a new thread based on those new questions.

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 ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

LATEST

Does your form require a signature? If so then hide the signature field until all the required fields have data in them.

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