cjauvin
cjauvin

Reputation: 3693

Programmatic validation + submit in an Acrobat PDF form

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.

Upvotes: 3

Views: 4482

Answers (1)

Bobrovsky
Bobrovsky

Reputation: 14236

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:

Upvotes: 2

Related Questions