For PDF files with fillable fields, there's an easy way to validate the entered data. In addition to marking fields as required in the PDF itself, you can also set additional validations.
To validate a PDF form field, you can trigger the following validation rules by naming the form field something that ends with the suffix -x-assently-… (see below).
NOTE! Don't use special characters in the field names!
Table of validation rules
|Suffix for PDF form field name||Description|
|*-x-assently-nationalid||validates any valid national ID number (Swedish personnummer, Finnish henkilötunnus/personbeteckning, example: YYYYMMDDXXXX, YYMMDD-XXXX, DDMMYY-XXXX)|
|*-x-assently-phone||any valid phone number (formatted as international phone format +46…)|
|*-x-assently-bankaccount||any valid bank account (Swedish bank account numbers, where both the clearing number and bank account number is entered in the same field)|
|*-x-assently-email||any valid email address (email@example.com)|
|any number with decimal separator (suitable for formfields for days, kronor, hours etc.)|
||any number with the value between minValue and maxValue (example: 1-100, 30-35, 0-10000)|
||any number, validating the number of characters between minLength and maxLength (t.ex. postal code 5 digits)|
any valid Swedish Company Registration Number, 10 digits with an optional dash
|*-x-assently-nationalidorcompanyid||validates both Swedish national ID and company ID in a combined field "Personnummer eller Organisationsnummer"|
Here we have two text fields for email addresses:
A text field where you can enter an amount between 10 and 1000.
A text field for national ID number