How To : Create Highly customizable yet simple form validation jquery plugin


Form validation is one of the most important aspect on any web application. More the form is secure more secure will be the application. So as to validate form using jquery , is really simple and can be highly customize.

.

Here is the DEMO how it looks.

How it works?

Simple, in this plugin we have to set three parameters for every required class. User can set his own class and define rule. Moreover , user can also set events onError and OnValid for a particular class thus giving user high customization, he/she can add their own effects , may be jquery animate() .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
required : { //required is a class
	rule : function() {
             // define some rule
	},
        onError : function() {
             //do something on error
	},
	onValid : function() {
            // do something on valid
	}
}, 
.
.
.
.
.
.
someNewClass: { //someNewClass is a class
	rule : function() {
             // define some rule
	},
        onError : function() {
             //do something on error
	},
	onValid : function() {
            // do something on valid
	}
},
 
submitHandler : function() {
	//do something on submit form
	return false; //remove this line if you need to refresh page on valid form
}

.

Using this function I have created this DEMO

Cheers!

email