3

Upon pressing the "submit" button of my PDF form, I'd like to do something (set a field to readonly) conditionally on the success of the form validation and submission processes:

if (form.isValid()) {
    submitForm(...);
    if (form.wasSubmittedSuccessfully()) {
        //doSomething();
    }
}

I'd like to know if there's an easy way to implement form.isValid() (i.e. verify that all required fields are non-null and correctly formatted) and form.wasSubmittedSuccessfully() above.

yms
  • 10,361
  • 3
  • 38
  • 68
cjauvin
  • 3,433
  • 4
  • 29
  • 38

1 Answers1

2

It seems like you need to embed some Javascript (validation function) in your PDFs and attach the function to click event of a submit button.

JavaScript™ for Acrobat® API Reference contains information about anything in Javascript supported by Adobe products. Some of the methods and properties are also supported by 3rd-part y viewers.

You can embed Javascript in a PDF using Acrobat Professional and a number of 3rd-party tools and libraries.

EDIT:

Here are couple of links that might help you to get started:

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
  • Thanks for taking the time to answer! I am aware of course that some JS is involved, and I am looking for a quick code snippet, as the manual you're referring to is rather bulky, and my searches in it didn't yet yield any result.. – cjauvin Feb 28 '12 at 14:20
  • @cjauvin what language / platform do you plan to use for the task? – Bobrovsky Feb 28 '12 at 16:40
  • Which language beside JS could I use for this (with Acrobat Pro X)? I'm not sure I understand your question, as well as the fact that my (perfectly honest and valid) question is now worth a negative value! It would be very useful for me to know why.. – cjauvin Feb 29 '12 at 02:02
  • @cjauvin I've updated my answer with couple of potentially useful links. As for downvote, I don't know why someone decided that your question is not good enough. – Bobrovsky Feb 29 '12 at 06:01