How to validate PDF form?

You could do something like this:

if (event.value > 3 && event.value < 10) {
    event.rc = false;
    app.alert({
        cMsg: "Please contact Larry at xxx to process your form.",
        cTitle: "My Window Title",
        nIcon: 0,
        nType: 1
    });
}

You can enter this validation script by editing the properties of a field. Go to "Validate Tab", click "Run custom validation script", then "Edit...". Type the code into the JavaScript Editor window, and then click "Ok" and "Close".

alt text
(source: skitch.com)


You can do this without javascript as long as you are OK with the default error message.

  1. In Acrobat, while in edit mode, right click on the field
  2. On the Format tab, set the format to Number
  3. On the Validate tab, choose the second option and set a low and a high number for your range.

Now, when a user tries to supply an answer outside that range, an popup box will alert them to the error.