JQuery Validate Custom CHECKSUM ajax checksum

Source: Internet
Author: User

Http://www.w3cschool.cc/jquery/jquery-plugin-validate.html This document is quite comprehensive!

Practice:

Some of the more complex checks, such as regular calibration, can be done by JQuery.validate.addMethod () Http://jqueryvalidation.org/jQuery.validator.addMethod

To implement, after adding, you can add a validation rule in the rules by Jquery.validate ()

JQuery.validator.addMethod ("Numorletter", function (value, Element) {return this.optional (element) | |/^[0-9|    A-z|a-z]+$/.test (value);}, "Please enter a number or letter"); $ ("#inputForm"). Validate ({    rules: {       //Name of the form to validate         Operationcode: {            //custom validation rules             Numorletter:true ,             //ajax checksum verifies whether the user's lost content exists in the database through the background service. Background service only needs to return True or False, Boolean type, String type can be               remote:{               // Here by get method, the parameter is placed after the URL, just start? After writing operationcode=, after the request is sent, the URL becomes?operationcode=&operationcode=value                //So it's removed.                URL: "${ctx}/ Operation/operation/validatecode? "+ $ (" #operationCode "). Val (),                 type: "GET",                 datatype: "JSON"                 //post mode, you can use                 //data:{paramname:value,...} Pass Parameters            }         }    },    messages:{        operationcode:{           //Specify error messages here              Remote: "The specified number already exists" &Nbsp;       }    }}); 

Official website http://jqueryvalidation.org/

Reference Document http://jqueryvalidation.org/


JQuery Validate Custom CHECKSUM ajax checksum

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.