Online Chat
 Call Us: 
1-877-744-1221
Browse Submit a Ticket
 
Advanced Search
Tools
Rss Categories

Field Validations

Author: Eileen Wilde Reference Number: AA-00166 Views: 27622 Last Updated: 07/31/2012 03:35 PM 25 Rating/ 2 Voters

Field Validations

  1. Overview
  2. Field Validations Reference
    1. allowed_values
    2. australian_phone_fields
    3. belgium_postcode_fields
    4. canadian_provincial_fields
    5. canadian_zip_fields
    6. char_limit
    7. char_min_limit
    8. conditional_required_fields
    9. credit_card_fields
    10. date_fields
    11. date_fields_delay
    12. disallowed_characters
    13. domain_fields
    14. dutch_postcode_fields
    15. email_fields
    16. euro_serial_number
    17. field_captions
    18. field_list_exclude
    19. file_filter_fields
    20. float_fields
    21. four_digit_year_fields
    22. france_postcode_fields
    23. french_phone_fields
    24. german_postcode_fields
    25. icd9_code_fields
    26. image_file_fields
    27. int_fields
    28. ip_fields
    29. ipv6_fields
    30. is_fields_set
    31. isbn_fields
    32. italian_codice_fiscale_fields
    33. italian_postcode_fields
    34. mac_address_fields
    35. month_fields
    36. monthday_fields
    37. msoffice_file_fields
    38. netherlands_postcode_fields
    39. percentage_fields
    40. required_fields
    41. required_empty_fields
    42. roman_num_fields
    43. same_fields
    44. set_value
    45. spanish_postcode_fields
    46. ssn_fields
    47. swedish_phone_fields
    48. swedish_zip_fields
    49. time_fields
    50. uk_bsc_fields
    51. uk_driver_license_fields
    52. uk_nin_fields
    53. uk_postcode_fields
    54. url_fields
    55. us_phone_fields
    56. us_state_fields
    57. vat_num_fields
    58. vin_fields
    59. weekday_fields
    60. word_fields
    61. word_limit
    62. year_fields
    63. zip_fields
    64. zip_files_fields
  3. 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:

[my_form]

email_fields = your_email (Your Email)

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:

validator_name = field_name1 (field title 1), field_name2 (field title 2), …

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:

email_fields = email (Email address)
zip_fields = zip
required_fields = name (First name), zip, email (Email address)

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:

allowed_values = fieldname (caption) = 1-15, 17, 19-30, word 1, word 2[;fieldname (caption) = 1-15, 17, 19-30]

Example:

allowed_values = fieldname (caption) = 1-15, 17, 19-30, hello, hiya

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:

char_limit = field_name (caption), char_count [; field_name (caption), char_count ...]

Example:

char_limit = somefield (caption), 6
VALID Hello, Dog
INVALID Greetings

char_min_limit

Validates minimum characters limit.

Syntax:

char_min_limit = field_name (caption), char_count [; field_name (caption), char_count ...]

Example:

char_min_limit = subject (Subject), 5
VALID Hello, Something
INVALID test, 123

conditional_required_fields

Checks if fields have been filled after checking user set condition.

Syntax:

conditional_required_fields = field_name (Field Caption), condition_to_make_this_field_required, error_msg

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:

conditional_required_fields = last_name, "{#first_name#}" != "John"
conditional_required_fields = last_name, "{#first_name#}" && "{#email#}"
conditional_required_fields = last_name, '{#first_name#}' == 'John' && ('{#email#}' contains 'gmail.com')

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:

date_fields_delay = field_name, delay_days, error message

Example:

For example you need user only input into the date field date that is week further from today.

date_fields_delay = lastname, 7, Date should be later that today + 7 days

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:

disallowed_characters = field_name (caption), "list of disallowed characters"

Example:

disallowed_characters = field_name (caption), "_-[]()"?"

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:

euro_serial_number = field_name (caption)

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:

field_captions = field1 (Field 1 caption)[, field2 (Field 2 caption)]

Example:

field_captions = altemail (Alternative Email Address)

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:

is_field_set = fieldname, pagenumber, error message[; fieldname2, page, error message2]
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.

VALID Sometext
INVALID

required_empty_fields

Checks if fields have not been filled.

VALID
INVALID Sometext

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:

same_fields =  field_name (field_caption) [, field_name2 (field_caption2), ...]

Example:

same_fields = email (Email), email2 (Repeat Email)

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:

set_value = [field_name] = "[value]" [; [field_name] = "[value]" [;...]]

Example:

set_value = company = "MyCompany"; state = "Alabama"

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:

word_limit = field_name (caption), word_count [; field_name (caption), word_count ...]

Example:

word_limit = message (Leave Your Message), 10
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:

allowed_files = ext
or
allowed_files = ext1|ext2|ext3

Example:

In your form:


<input type="file" name="attach">

Config file:

allowed_files = gif|bmp|png
file_filter_fields = attach (Picture)

Result:    

Only *.gif, *.bmp, *.png files are allowed for user upload.