Field Validations
- Overview
- Field Validations Reference
- allowed_values
- australian_phone_fields
- belgium_postcode_fields
- canadian_provincial_fields
- canadian_zip_fields
- char_limit
- char_min_limit
- conditional_required_fields
- credit_card_fields
- date_fields
- date_fields_delay
- disallowed_characters
- domain_fields
- dutch_postcode_fields
- email_fields
- euro_serial_number
- field_captions
- field_list_exclude
- file_filter_fields
- float_fields
- four_digit_year_fields
- france_postcode_fields
- french_phone_fields
- german_postcode_fields
- icd9_code_fields
- image_file_fields
- int_fields
- ip_fields
- ipv6_fields
- is_fields_set
- isbn_fields
- italian_codice_fiscale_fields
- italian_postcode_fields
- mac_address_fields
- month_fields
- monthday_fields
- msoffice_file_fields
- netherlands_postcode_fields
- percentage_fields
- required_fields
- required_empty_fields
- roman_num_fields
- same_fields
- set_value
- spanish_postcode_fields
- ssn_fields
- swedish_phone_fields
- swedish_zip_fields
- time_fields
- uk_bsc_fields
- uk_driver_license_fields
- uk_nin_fields
- uk_postcode_fields
- url_fields
- us_phone_fields
- us_state_fields
- vat_num_fields
- vin_fields
- weekday_fields
- word_fields
- word_limit
- year_fields
- zip_fields
- zip_files_fields
- File extensions allowed for upload
Overview
Form Processor Pro allows you to control, check, and verify user input data by using a number of bundled validating functions. It means you may set restrictions or requirements for any field on your form. For example, if you have some text field, named “your_email” and you want to be sure that all users provide you correct email address and nothing else; you should add the following line to your form configuration:
By doing this, you are forcing form users to provide you with a correct email address in the field named “your_email”
Detailed syntax of the major form validator configurations:
Where:
validator_name - is the name of the Form Processor Pro validator.
field_name1, field_name2 - are the names of the fields on your form. Names must be the the exact name of the HTML element.
Also, you may use special “field titles” for your fields, written in round brackets. They will be shown in error message, if the field contains any errors or mispellings, otherwise the field_name will be shown if there is no field title specified.
Examples:
In example #1 we require form users to input a correct email address in field “email”. If it is not a valid email address the error message will be generating, like:
Field "Email address" is not correct email address
Example #2: we are checking the zip code on field “zip”. As you can see it is not necessary to use field titles.If the zip code is not valid, the following message will be shown:
Field "zip" is not a correct zip code
Moreover, you can apply more than one field in a validation set. In example 3 above, we set the fields name, zip, and email as required all in one validation line.
Field Validations Reference
allowed_values
Validates numbers validator (not less, not bigger or equal)
Syntax:
Example:
Result:
VALID |
3, 17, hello |
INVALID |
445, temp, 18 |
australian_phone_fields
Verifies Australian phone numbers. Matches all known formats including normal 10-digit landline numbers (valid area code mandatory) 13, 1300, 1800, 1900, 1902 plus mobile 10 and 11-digit formats.
VALID
|
0732105432, 1300333444, 131313
|
INVALID
|
32105432, 13000456
|
belgium_postcode_fields
Validates postcodes for Belgium
VALID
|
1234
|
INVALID
|
123, 123A
|
canadian_provincial_fields
Validates provincial codes of Canada.
VALID
|
ON, PE, NB
|
INVALID
|
OB, NM
|
canadian_zip_fields
Verifies that Canadian postal code format is correct.
VALID
|
M1R 4B0, L0R 1B1, L0R1B9
|
INVALID
|
W1R 4B0, L0R 1D1, LOR1B9
|
char_limit
Validates characters limit.
Syntax:
Example:
VALID
|
Hello, Dog
|
INVALID
|
Greetings
|
char_min_limit
Validates minimum characters limit.
Syntax:
Example:
VALID
|
Hello, Something
|
INVALID
|
test, 123
|
conditional_required_fields
Checks if fields have been filled after checking user set condition.
Syntax:
condition_to_make_this_field_required can contains any expression using logical operators: = (for "equals"), != (for "not equals"), || (for "OR"), && (for "AND"). If you do not check the value of some field, Form Processor Pro will check if this field filled. Special parameters: contains and does_not_contain, which check if word or phrase is contained or not in some variable.
Example:
First line: if first_name is not empty, last_name will be required to be filled
Second line: if first_name and email are not empty, last_name will be required to be filled
Third line: if firs_tname has the value 'firstname' and email contains gmail.com, last_name will be required to be filled.
credit_card_fields
Verifies major credit card numbers, including: Visa, MasterCard, Diners Club, Carte Blanche, Discover and American Express.
IMPORTANT: It does not do REAL credit card validation; it only checks that the data input could be a credit card number.
VALID
|
4111-2222-3333-4444, 3411 222222 33333, 5111222233334444
|
INVALID
|
4111-2222-3333-444, 3411-2222-3333-4444, Visa
|
date_fields
Validates date fields
VALID
|
10 September 2000, 12-12-2006, 31 Dec 9999, 29 Feb 2004
|
INVALID
|
MMVIII, 29 Feb 2002, 13 Octo 1998, 32 May 1913
|
date_fields_delay
Checks if date filled to the field isn't sooner of user set delay.
Syntax:
Example:
For example you need user only input into the date field date that is week further from today.
Result:
User won't be able to input date that is sooner than week from the day user submits the form.
disallowed_characters
Checks the field input and ensures that it doesn't have any of the listed disallowed characters.
Syntax:
Example:
domain_fields
Validates domain names.
VALID
|
email-form.com, example.co.uk
|
INVALID
|
http://email-form.com, test@mitridat.com
|
dutch_postcode_fields
Dutch zip code verification
VALID
|
1054 WD, 1054WD, 1054 wd
|
INVALID
|
10543
|
email_fields
Validates an RFC 2822 email addresses
VALID
|
user@domain.com, user.id@domain-name.com
|
INVALID
|
userdomain.com, user@300.0.0.1, .user@-domain-.com
|
euro_serial_number
Validates euro banknote serial numbers.
Syntax:
field_captions
This is not actually validator, but it used to set names of the fields that are not validated (for example for using them in generated files)
Syntax:
Example:
field_list_exclude
This option purges field from fields list, for example if you don't want some field to be shown while using Predefined Variable: {#%FIELDS_LIST_HTML#}, or if you don't want to show this field in the generated files.
file_filter_fields
File type validation. Allow a user to enter only files with allowed extensions.
See "File extensions allowed for upload" for examples.
float_fields
Validates decimal numbers
VALID
|
12, 0.25, 36.678
|
INVALID
|
A10, $25.10
|
four_digit_year_fields
Validates the number of the year. Only used on four digit format.
VALID
|
2007, 1996
|
INVALID
|
132, 24566
|
france_postcode_fields
Validates postcodes for France (including colonies)
VALID
|
12345, F-12345, F-2B100
|
INVALID
|
S123456, F-123456, 123456
|
french_phone_fields
Validates phone numbers in France.
VALID
|
01 46 70 89 12, 01-46-70-89-12, 0146708912
|
INVALID
|
01-46708912, 01 46708912, +33235256677
|
german_postcode_fields
Validates German postal codes (PLZ or Postleitzahlen)
VALID
|
12556, 01550, 80796
|
INVALID
|
05234, 8973, 62980
|
icd9_code_fields
ICD9 code validation.
VALID
|
E123., 123.0, 045.23
|
INVALID
|
b123., 3456.0
|
image_file_fields
Validates image file names.
VALID
|
picture.jpg, picture.gif
|
INVALID
|
picture.doc, picture.zip
|
int_fields
Validates integer numbers.
VALID
|
0, 5, 71
|
INVALID
|
12.23, ABC
|
ip_fields
Validates the format of IP Addresses.
VALID
|
127.0.0.1, 255.255.255.0, 192.168.0.1
|
INVALID
|
1200.5.4.3, abc.def.ghi.jkl, 255.foo.bar.1
|
ipv6_fields
Validates full and compressed IPv6 addresses as defined in RFC 2373.
VALID
|
FEDC:BA98:7654:3210:FEDC:BA98:7654:3210, 1080::8:800:200C:417A, ::FFFF:129.144.52.38
|
INVALID
|
FEDC::7654:3210::BA98:7654:3210, FEDC:BA98:7654:3210, ::
|
is_fields_set
Checks if fields was set (for example you pass with GET method to the form)
syntax:
VALID
|
http://yourdomain.com/fpp/index.php?fieldname=25
|
INVALID
|
http://yourdomain.com/fpp/index.php
|
isbn_fields
Validates ISBN number.
VALID
|
0 93028 923 4, 1-56389-668-0, 1-56389-016-X
|
INVALID
|
123456789X, 9-87654321-2, 123 456-789X
|
italian_codice_fiscale_fields
Validates Italian fiscal code (codice fiscale).
VALID
|
SPGGRG73A02E625S czzdll74h18f205w
|
INVALID
|
SP6FFFF3A02E625S, czzdll74h18f205
|
italian_postcode_fields
Checks postcodes for Italy (including possible Vatican/Italy indications)
VALID
|
1234, V-1234
|
INVALID
|
12345
|
mac_address_fields
Verifies a MAC address with hex values separated by a colon
VALID
|
00:00:39:F9:3C:59, 00:90:83:6A:B3:B7, 00:00:39:59:30:5C
|
INVALID
|
00:0H:39:59:30:5C, 00:39:59:30:5C, 00:39:59:30:5C:BZ
|
month_fields
Month name (number) validation.
VALID
|
2, 05, 11, Jul, August
|
INVALID
|
0, 13, jne
|
monthday_fields
Checks if the field value is between 1 and 31.
VALID
|
15, 30
|
INVALID
|
32, -3
|
msoffice_file_fields
Microsoft Office filename validation.
VALID
|
document.doc, spearsheet.xls
|
INVALID
|
document.dll, spearsheet.exe
|
netherlands_postcode_fields
Validates postcodes for the Netherlands.
VALID
|
1234AB, 1234 AB
|
INVALID
|
123BBB, 023AB
|
percentage_fields
Validates percentage numbers.
VALID
|
13%, 24.85%
|
INVALID
|
13, 24.5, .12%
|
required_fields
Checks if fields have been filled.
required_empty_fields
Checks if fields have not been filled.
roman_num_fields
Roman numerals validation.
VALID
|
XXL, MCMXCIX, III
|
INVALID
|
ALPHA, I9E
|
same_fields
Checks to see if all listed fields have the same value.
Usage:
Example:
This example will validate fields email and email2 to have same values.
set_value
Used to set a value to the variable. For example if you want to have some predefine variable.
Usage:
Example:
Result:
{#company#} will show MyCompany, and {#state#} will show Alabama
spanish_postcode_fields
Validates Spanish postcodes
VALID
|
01234, 50000, 12345
|
INVALID
|
00, 999
|
ssn_fields
U.S. social security numbers (SSN) validation
VALID
|
145470191, 145 47 0191, 145-47-0191
|
INVALID
|
000470191, 145-00-0191, 145.47.0191
|
swedish_phone_fields
Validates Swedish phone numbers according to SIS standard
VALID
|
+46 8 123 456 78, 08-123 456 78, 0123-456 78
|
INVALID
|
+46 08-123 456 78, 08 123 456 78, 0123 456 78
|
swedish_zip_fields
Validates Swedish zip codes (postnr) with or without space between groups. With leading s- or not
VALID
|
12345, 932 68, S-621 46
|
INVALID
|
5367, 425611, 31 54
|
time_fields
Checks to see if values are correct timestamps.
VALID
|
1:01 AM, 23:52:01, 11:04 pm, 03.24.36 aM
|
INVALID
|
24:03, 13 pm
|
uk_bsc_fields
Validates UK Bank Sort code
VALID
|
09-01-29, 05-06-25
|
INVALID
|
090125
|
uk_driver_license_fields
Checks for UK Drivers License format
VALID
|
JOHNS711215GG9SY
|
INVALID
|
JOHNS731215GG9SY
|
uk_nin_fields
UK National Insurance Number (NINo) validation
VALID
|
JG103759A, AP019283D, ZX047829C
|
INVALID
|
DC135798A, FQ987654C, KL192845T
|
uk_postcode_fields
UK postcode validation
VALID
|
W1A 1AA, EC2V 1JN, GIR 0AA
|
INVALID
|
TB12 1AB, EC2V 1JM, W2A 1AA
|
url_fields
Checks to see if the value is a correct full URL address.
VALID
|
http://www.email-form.com/online-manual/index.html, mailto:support@web-site-scripts.com, ftp://ftp.mysite.com
|
INVALID
|
www.google.com, microhard.com
|
us_phone_fields
Checks for US phone numbers with optional leading 1, an optional area code, and optional delimiters (hyphen, space, or period)
VALID
|
18005551212, 1.800.555.1212, 1-800-555-1212, (800)555-1212, 8005551212, 800-555-1212, 800.555.1212, 5551212, 555-1212, 555.1212
|
INVALID
|
2-800-555-1212, 55-5212, 551212, 15551212
|
us_state_fields
Chekcs US state two character abbreviations
VALID
|
CO, GA, TX
|
INVALID
|
A, ZZ, Florida
|
vat_num_fields
Validates VAT numbers
VALID
|
GB464645, AT134645
|
INVALID
|
GB1321, D5464D
|
vin_fields
Checks Vehicle Identification Numbers (VINs)
VALID
|
abcDEFghp3t123456, A1C3E5G6Y98123456, A1C3E5G6FFF123456
|
INVALID
|
ABBBC3E5G6F9F12345HHH
|
weekday_fields
Weekday names (numbers) validation.
VALID
|
3, 05, Tue, Sunday
|
INVALID
|
8, 09, 12, Wdn, 1st
|
word_fields
Checks for single words
VALID
|
someword
|
INVALID
|
The word
|
word_limit
Validates if number of words not greater than stated.
Syntax:
Example:
VALID
|
This is some message
|
INVALID
|
This message is longer than 10 words, so it cannot be passed.
|
year_fields
Validates the number of the year.
VALID
|
2007, 06, 98
|
INVALID
|
132, 24566
|
zip_fields
US (ZIP and ZIP+4) validation
VALID
|
55127, 55127-1234
|
INVALID
|
D11, 501-555
|
zip_files_fields
Checks for zip archive files extents
VALID
|
secret.zip
|
INVALID
|
file.doc
|
File extensions allowed for upload
Set the allowed file extensions for user uploaded files in file_filter_fields.
Syntax:
Example:
In your form:
Config file:
Result:
Only *.gif, *.bmp, *.png files are allowed for user upload.