These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

PDF with Required Fields

usakoi84
Registered: Jun 8 2009
Posts: 2
Answered

I am VERY new to creating PDF files and know the basics for setting one up. I know how to do required fields when submitting the file to be e-mailed, but I would like to learn a few tricks:

1) How to make an alert when the user leaves the field without entering anything in it.

2) How to make it so if one field is filled in, another similar one is required to fill in.
Example: If 'First Name' is filled in, 'Last Name' must be filled in as well, otherwise if neither are filled in, neither are required.

3) Scenario 2 will also include radio buttons.

Hopefully these questions make sense. Please help me asap! :D
Thank you!
-Danie

My Product Information:
Acrobat Pro 9.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
As you already know, Acrobat provides a range of built-in features for controling form interaction. All of these built in features are either simple and straight forward, like the default form field formatting and validation, or very narrow, like the form distribution wizard.

Most of the interactive features are programable, so if you want more flexibility you'll have to learn some JavaScript. For example, to display an alert when the user leaves a field without entering anything you could create a custom validation script like this:

if(/^\s*$/.test(event.value))
app.alert("Empty Field");

Actually you might want to use an OnBlur event, or a combination to get the right action. But JavaScript is the trick.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script