affordable web development services
| About Us | Services | Download | Order | Support | Subscribe to News Feed Follow us on Twitter Join us on Facebook |
 

Tigra Form Validator PRO v1.3 - Documentation

Table of Contents

Description

Tigra Form Validator is professionally designed JavaScript component performing client-side form validation of any complexity. The script supports most of the data types used in online forms and it can be easily extended with any custom types. Offering rich feature set and great browser compatibility Tigra Form Validator PRO is suitable for any HTML form imaginable so visitors benefit from uniform, intuitive and friendly client-side validation.

Features

Compatibility Table

Tigra Form Validaror PRO can work with any browser capable of generic DHTML.
Here is a table of the application compatibility:

Platform Browser
MS IE Netscape Mozilla Opera Safari
Windows 95/98/ME/2000/XP 4.0+ 4.08+ 0.9+ 6.0+ n/a
Mac OS 8/9/X 5.0+ 4.7+ 0.9+ 6.0+ 1.0+

Files

Tigra Form Validator PRO distribution package contains the following files:

Where ? and * are wildcards for single character and substring respectively.

Adding Form Validator to HTML Page

First thing to be done to the document where Tigra Form Validator PRO will be used then is attaching product core script to a header with appropriate tag:

<head>
  <!-- some header data -->
  <script language="javascript" src="validator.js"></script>
</head>

To validate fields of a HTML form Tigra Form Validator PRO script has to create a JavaScript object instance for that form. Such a creation is done with a JavaScript line called "constructor call". So the number of constructor calls in a HTML document should be equal to a number of HTML forms the script is desired to serve.

Here is sample Tigra Form Validator PRO constructor call:

var v = new validator('test', o_fields, o_config)

The constructor is supplied with 3 parameters:

IndexDescriptionTypeIf requiredIn above sample
1 a string form name inputs to fields of which are to be validated by the script stringyes'test'
2 a JavaScript structure or a reference to a structure describing fields inputs of those are to be validated objectyeso_fields
3 a JavaScript structure or a reference to a structure describing validator settings objectnoo_config

The constructor is a function returning a reference to created object instance once being called. It is necessary to store that reference in a variable because it will be used then. In above sample such variable name is v.

Note that all constructor calls have to be placed only after the place where product core script is attached to the document.

Last step of adding Tigra Form Validator PRO to the document is handling on form submit event. Validator object instance created by the constructor has a method of exec(). That method call code has to be added to onsubmit form tag modifier value. Turning back to the above sample of validator constructor call, if having validator object instance named as v, the opening tag of test HTML form will look like the following:

<form name="test" ... onsubmit="return v.exec()">

Describing Fields

Form fields inputs of those you would wish to validate are described with Fields Describing Structure, a JavaScript structure that contains names and attributes of those fields. Each form field you need to validate corresponds to one record of the structure - a descriptor - named exactly as that field. A descriptor is made up of a key (descriptor name) - a string containing corresponding field name, a colon (:) and a structure of field attributes:

<field name> : {<structure of field attributes>}

All descriptors are enclosed in curly brackets ({}) and separated with commas (,).

Field Attibutes

To tell validator script in which way an input of the field has to be validated each descriptor contains field attribute structure. The structure is a set of field attribute descriptors enclosed in curly brackets ({}) and separated with commas (,). Each field atribute descriptor consists of a name (string), colon (:) and value:

<field name> : {
  // structure of field attributes
  <attribute 1> : <value of attribute 1>,
  <attribute 2> : <value of attribute 1>,
  ....
  // any attributes here
  ....
  <attribute n> : <value of attribute n>
}

Below is a table of field attribute descriptors currently supported:

Name
(key)
Description
(regarding corresponding field)
Values
accepteddefault
 
l Field label to refer the field in messages a string (required attribute)
r If the field is required boolean false
f Field format the input has to meet predefined format name,
a regular expression or
a function
(is not used)
t id of a HTML element to highlight if input is not valid a string (is not used)
m A name of another form field this field input must match. Usefull for password copies a string (is not used)
mn The least number of characters the field can contain a positive integer number (is not used)
mx The most number of characters the field can contain a positive integer number (is not used)

Field Format

Tigra Form Validator PRO supports a feature of checking if form field input meets certain pattern (format). There are 3 ways of supplying format for fields: