Home > Web Front-end > JS Tutorial > body text

JQuery form validation plug-in EasyValidator usage analysis_jquery

WBOY
Release: 2016-05-16 16:31:14
Original
2385 people have browsed it

The example in this article describes the usage of JQuery form validation plug-in EasyValidator. Share it with everyone for your reference. The details are as follows:

The purpose of this plug-in is: users do not need to write a line of JS verification code, they only need to add the corresponding verification attributes to the form to be verified, making the verification function easy to maintain, scalable, and easier to use.

DEMO already contains commonly used regular expressions, which can be reused directly. In order to consider scalability, you can write your own regular expressions according to the special needs of different users.

Function implemented by EasyValidator:

1. Prompt function (add tip="the text you want to prompt" in the form or other tags)

For example:

Copy code The code is as follows:

or

Copy code The code is as follows:

2. Ordinary form verification (add reg="regular expression" to the form)
For example:

Copy code The code is as follows:

Ordinary form validation DEMO: http://easyvalidator.googlecode.com/svn/trunk/index.html

3. AJAX form verification (add url="verification system address" to the form)
For example:

Copy code The code is as follows:

AJAX verification DEMO: There is no online demonstration. Please run ajax_demo.html locally and request the remote PHP file. Of course it can be JSP or ASP. I have preset some existing data in the program for users to refer to.

4. Ordinary form verification AJAX form verification (after passing the ordinary verification, perform AJAX verification)
For example:

Copy code The code is as follows:

5. Extended function form validation (some special business needs):

These special needs are based on business. Here are some situations:

1. Verification of the number of checkbox selection boxes, such as limiting others to select at least 1 checkbox and up to 5 checkboxes.
2. Compare multiple forms. For example, the [Start Time Form] must be less than or equal to the [End Time Form] or the two password forms must be equal when used for registration, etc.

Due to the particularity of this situation, users have to write their own business logic code. The official has provided the extendsValidate extension function, and just write their own logic code in it.

Extended function form validation DEMO: http://easyvalidator.googlecode.com/svn/trunk/extends_demo.html

BUG fix log:
2010-9-24: Fix multiple FORM submission bugs on the same page, TIP misplacement bug
2010-9-26: Added bgiframe plug-in to fix the problem that TIP cannot be masked in IE6
2010-9-27: Add extension API and reconstruct core library

2011-1-1 : Separate the TIP of form verification, making TIP, URL, and REG exist as separate components, which is more flexible!

2011-1-28: Modified the AJAX TIP error correction bug, modified the logic, and set the encoding of the remote program validate_user.php of the AJAX request to GB2312.

Official download address: http://code.google.com/p/easyvalidator/downloads/list

Or click here to download from this site. http://www.jb51.net/jiaoben/32303.html

Online regex validator: http://regexpal.com/

I hope this article will be helpful to everyone’s web programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!