Skip to content

maxschuster/jQuery.validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery.validator

Licence: Apache License, Version 2.0
Demo: http://dev.maxschuster.eu/jQuery.validator/

Client-Side Form Input validation jQuery Plugin.

Includes:

https://github.com/maxschuster/jQuery.timer

Documentation

Methods

init

Initializes the validator plugin on the given set of jQuery elements with the given set of options

Usage:

$('selector').validator(options);

Parameters:

Parameter Type Description
options Object Settings with which the plugin should be initialized (see Settings)

Returns:

jQuery Object To provide chainability.


valid

Checks if every matching element (that has jQuery.validator initialized on it) has a valid value.

Usage:

$('selector').validator('valid');

Parameters:

none

Returns:

Boolean True if all elements are valid or false if not.


enable

Enables the form checking for the given set of jQuery elements.

Usage:

$('selector').validator('enable');

Parameters:

none

Returns:

jQuery Object To provide chainability.


disable

Disables the form checking for the given set of jQuery elements.

Usage:

$('selector').validator('disable');

Parameters:

none

Returns:

jQuery Object To provide chainability.


destroy

Completely removes the form checking for the given set of jQuery elements.

Usage:

$('selector').validator('destroy');

Parameters:

none

Returns:

jQuery Object To provide chainability.

Options

Name Type Default Description
ajax String | Boolean false Url of the ajax file. File has to return true or false as json.
liveCheck Boolean false If true the check will be triggred on every keydown, keyup, keypress, change and blur event. If it is false the check will only be executed of every change and blur event.
mask String | RegExp 'required' The regular expression which the contents of the input will be matched against is. Can be a self-defined regular expression or the name of a predefined expression (eg email).
optional Boolean false If true then the value could be empty.
rel jQuery Object | Boolean false Defines that the current element is related to another element and must have the same value. Used for "Retype Password" fields.
predefinedMasks Object {'email': ..., ...} Contains predefined regex mask with their name as key. (See predefinedMasks)

predefinedMasks

Name Description
email Value must match the email format
required The value must not be empty
zip_code_ger_and_at The value must match the german or austrian zip code format
no_white_space The value must not contain whitespaces
number The value must be a number "." and "," allowed.
integer The value must be an integer.
date_day_month_year Date in the format D(D).M(M).YYYY.
date_year_month_day Date in the format YYYY-MM-DD.

More suggestions are allways welcome... ;-)

Events

valid.validator

Gets triggered if the value of the input has become valid.

invalid.validator

Gets triggered if the value of the input has become invalid.

checkedvalue.validator

Gets triggered if the current value of the input has been checked.

Style Classes

validator

Added to every element that has jQuery.validator attached.

validator-invalid

Added to every element that has an invalid value.

About

Client-Side Form Input validation jQuery Plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published