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

Share

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() .

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!

  • March 22, 2010
8 Best Free Stock Video Websites for Tiktok, Reels, and Shorts Top 5 PHP Frameworks: Fast and Secure