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 (example@example.com) |
*-x-assently-number or |
any number with decimal separator (suitable for formfields for days, kronor, hours etc.) |
*-x-assently-number-minValue- |
any number with the value between minValue and maxValue (example: 1-100, 30-35, 0-10000) |
*-x-assently-double-minLength- |
any number, validating the number of characters between minLength and maxLength (t.ex. postal code 5 digits) |
*-x-assently-companyid |
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" |
Examples
Here we have two text fields for email addresses:
personal-address-x-assently-email
work-address-x-assently-email
A text field where you can enter an amount between 10 and 1000.
amount-x-assently-number-10-1000
A text field for national ID number
applicant-x-assently-nationalid
Comments
0 comments
Please sign in to leave a comment.