This example describes the jquery form validation plug-in easyvalidator usage. Share to everyone for your reference. Specifically as follows:
The purpose of this plug-in is: Users do not need to write a line of JS validation code, just in order to verify the form to add the corresponding validation properties, so that the verification function easy to maintain, scalable, easier to start.
Demo has included a commonly used regular expression, can be directly reused, in order to consider extensibility, so for different users special needs, write the regular bar.
Easyvalidator Implementation Features:
1. Hint function (add tip= "text to hint" in form or other tag)
Such as:
Copy Code code as follows:
<input name= "name" tip= "Please enter your name yo ~" >
Or
Copy Code code as follows:
<a href= "http://wangking717.iteye.com/blog/769021" tip= "to Easyvalidator official homepage" target= "_blank" > have doubts can come here to ask < /a>
2. Common form verification (add reg= "regular expression" to the form)
such as:
Copy Code code as follows:
<input name= "username" reg= "regular"/>
Common form Verification demo:http://easyvalidator.googlecode.com/svn/trunk/index.html
3. Ajax form verification (add Url= "Verify system Address" to the form)
such as:
Copy Code code as follows:
<input name= "username" url= "Address"/>
Ajax Verification Demo: No online demo, please run ajax_demo.html in the local, request remote PHP file, of course, for JSP or ASP, I am here in the program preset some existing data, users can refer to themselves.
4. Common form verification + Ajax form verification (after normal validation through, then Ajax validation)
such as:
Copy Code code as follows:
<input name= "username" reg= "regular" url= "address"/>
5. Extended function Form validation (certain business-specific requirements):
These special needs are based on business, and here's a list of things like this:
1.checkbox selection box number validation, such as restricting the selection of at least 1 people, select up to 5 checkboxes.
2. Comparisons between multiple forms, such as "Start Timesheet form" must be less than or equal to "end Timesheet list" or two password forms to register, etc.
Because of the specificity of this situation, users have to write their own business logic code, the official has provided the extendsvalidate extension function, in which to write their own logical code.
Extended function Form Validation demo:http://easyvalidator.googlecode.com/svn/trunk/extends_demo.html
Bug Repair log:
2010-9-24: Repair the same page multiple form submit bug, Tip dislocation bug
2010-9-26: Add bgiframe plugin, fix IE6 under Tip cover not select form
2010-9-27: Increase the expansion API and refactor the core library
2011-1-1: Will form verification tip independent, let Tip,url,reg become a separate form and exist, more flexible!
2011-1-28: Modified Ajax tip Error correction bug, logical modification, and set GB2312 for AJAX-requested remote program validate_user.php encoding.
Official Download Address: http://code.google.com/p/easyvalidator/downloads/list
or click here to download the site. Http://www.jb51.net/jiaoben/32303.html
Online Regular Validator: http://regexpal.com/
I hope this article will help you with your Web programming.