Validating filled out data
Interactive PDF forms allow end users to fill out fields. The values filled out by the end user sometimes need validation. For instance, to verify that only a valid code is entered, or a number is in an acceptable range.
variaDoc enables you to add validation to fields. These validations can be executed on the client (like in Acrobat) or on the the server in the variaDoc Form Receiver, or both.
Note that the validations are not executed during the merge process.
Client side validation
Fields can be validated in the client application (e.g. Acrobat Reader). This validation occurs when the field value is edited and the field loses the input focus.
To create such a validation, add a validator node to the applicable field node. First, make sure that the field is interactive. You can do this in the Settings tab.
In the sample above the address field has a Required field validator. This ensures that the field has a non-empty value.
Validations can also be combined.
In the above sample the name field is required and must be within a specified range.
Server side validation
Server side validation is independent from the application used to read/fill the PDF. Therefore, it is a good addition to client side validation in order to prevent invalid data from entering your system.
Also certain validation cannot be executed client side, e.g. because they need access to a database.
To add server side validation, add a Server side validation node as child of the Receive actions node.
The Server side validation node has the following options:
Submit PDF to user in case of validation errors
When checked, the variaDoc form receiver will automatically send the submitted document back to the end user if it detects (an) invalid field(s). The end user should correct the errors and re-submit the form.
Show dialog with error message
When checked, a message box is shown to the end user in the PDF reader with a description of the error message.
Highlight fields with validation errors
When checked, the background color of fields with a validation error is changed.
Set error message in tooltip of fields with validation errors
When checked, the tooltip of the fields with validation errors is changed so that it contains the error description.
Below the Server side validation node you can add field validations.
In a field validation node you must specify the name of the field you want to validate. This can also be a regular expression. With a regular expression you can select multiple fields, such as in the sample above.
Below a field validation node, you should add the validator(s). This is similar to validator(s) below a field node in client side validation.
Some PDF forms have several fields that should have the same validators. To reduce the number of validators, you can create a single validator definition and refer to it in all those field.
In the above sample a single validator definition called CountValidator is defined. It is re-used in the pepperoni, onions and bacon fields.