Manual Validation of jQuery Validation Plugin verification plug-in, jqueryvalidation
Jquery. validate is a verification framework of jquery. With the advantages of jquery, we can quickly verify some common input and expand our own verification methods, it also provides good support for internationalization.
The normal verification mode is as follows:
<Form id = "ff" action = "xxx">... <input type = "submit" value = "submit"> </form> [java] view plaincopy: view the CODE piece on the CODE to derive to my CODE piece $ ('# ff' ). validate ()
In this way, you only need to click the submit button and the plug-in will automatically perform verification.
However, sometimes we want to click another button to verify the form and then perform the rest based on the form verification result.
Check the source code and find a form () method. This method is used for verification, although the literal meaning of the method is not consistent.
Then we can perform the following operations:
Var validator; // declare a global variable $ (function () {validator = $ ('# ff '). validate (); // This statement returns an object}) function add () {var B = validator. form (); // return a Boolean value if (B) {// Verification Successful // do add ...}} <button onclick = "add ()"> Save </button>
If an error occurs during verification, the error message is displayed. To clear the error message, call validator. resetForm ();
With the validator. form () and validator. resetForm () methods, we can flexibly use the verification plug-in.
Verification Field
Required-required field
Remote-remote verification
Minlength-minimum length Verification
Maxlength-maximum length Verification
Rangelength-length range Verification
Min-Minimum value verification
Max-maximum value verification
Range-value verification
Email-email address verification
Url-URL address verification
Date-date Verification
DateISO-ISO Date Format Verification
Number-decimal number verification
Digits-digit Verification
Creditcard-credit card number verification
Verify to-the same value as another text box
Articles you may be interested in:
- JQuery Form Verification plug-in formValidation for personalized error messages
- JQuery 1.3 and Validation plugin 1.5.1
- An example of jquery validation plug-in Form Verification
- JQuery Validation plug-in remote verification method Bug Solution
- Question about Remote verification in JQuery's Validation plug-in
- JQuery Validation instance code makes verification so easy
- ASP. NET jQuery instance 11 verifies the logon page by using the jQuery validation plug-in.
- Modify the default verification method in jQuery Validation
- Ajax verification implementation code for jQuery Validation-Engine in ASP. NET
- Ajax verification of jQuery Validation-Engine in ASP. NET
- Jquery validation verification ID card number, passport, phone number, email (instance code)
- Solutions to cache problems verified by Jquery validation remote
- JQuery validation plugin validation Guide
- Usage of jQuery Validation PlugIn