The built-in verification method of JQueryIvalidatebox Extension

Source: Internet
Author: User
Tags email account
$. Extend ($. fn. validatebox. defaults. rules, {minLength: {// judge the minimum length validator: function (value, param) {returnvalue. length & gt; param [0] ;}, message: & amp; #39; enter at least {0} characters. & Amp; # $. extend ($. fn. validatebox. defaults. rules, {minLength: {// judge the minimum length validator: function (value, param) {returnvalue. length> = param [0] ;}, message: 'At least {0} characters are entered. '}, Length: {validator: function (value, param) {varlen = $. trim (value ). length; returnlen> = param [0] & len <= param [1] ;}, message: "The length of the input content must be between {0} and {1. "}, phone: {// verification phone number validator: function (value) {return/^ (\ d {2, 3 }\)) | (\ d {3 }\-))? (\ (0 \ d {2, 3} \) | 0 \ d {2, 3 }-)? [1-9] \ d {6, 7} (\-\ d {1, 4 })? $/I. test (value) ;}, message: 'The format is incorrect. Please use the following format: 020-88888888'}, mobile: {// verify the mobile phone number validator: function (value) {return/^ (13 | 15 | 18) \ d {9} $/I. test (value) ;}, message: 'incorrect Mobile Phone Number Format '}, idcard :{// verify ID card validator: function (value) {return/^ \ d {15} (\ d {2} [A-Za-z0-9])? $/I. test (value) ;}, message: 'incorrect ID card number format '}, intOrFloat: {// verify the integer or decimal validator: function (value) {return/^ \ d + (\. \ d + )? $/I. test (value) ;}, message: 'enter a number and make sure the format is correct '}, currency: {// verify the currency validator: function (value) {return/^ \ d + (\. \ d + )? $/I. test (value) ;}, message: 'currency format incorrect '}, qq: {// verify QQ, validator: function (value) from 10000) {return/^ [1-9] \ d {4, 9} $/I. test (value) ;}, message: 'incorrect QQ number format '}, integer: {// verification integer validator: function (value) {return/^ [+]? [1-9] + \ d * $/I. test (value) ;}, message: 'enter an integer '}, chinese: {// verify the chinese validator: function (value) {return/^ [\ u0391-\ uFFE5] + $/I. test (value) ;}, message: 'enter Chinese '}, english: {// verify english validator: function (value) {return/^ [A-Za-z] + $/I. test (value) ;}, message: 'enter the English'}, unnormal: {// verify whether it contains spaces and invalid characters validator: function (value) {return /. +/I. test (value) ;}, message: 'enter value cannot be blank and contain other illegal characters '}, username: {// verify username validator: fu Nction (value) {return/^ [a-zA-Z] [a-zA-Z0-9 _] {5, 15} $/I. test (value) ;}, message: 'invalid User Name (starting with a letter, 6-16 bytes allowed, letter or digit underline allowed) '}, faxno: {// verify the fax validator: function (value) {// return/^ [+] {0, 1} (\ d) {1, 3} []? ([-]? (\ D) | []) {1, 12}) + $/I. test (value); return/^ (\ d {2, 3} \) | (\ d {3 }\-))? (\ (0 \ d {2, 3} \) | 0 \ d {2, 3 }-)? [1-9] \ d {6, 7} (\-\ d {1, 4 })? $/I. test (value) ;}, message: 'incorrect fax number '}, zip: {// verify the zip code validator: function (value) {return/^ [1-9] \ d {5} $/I. test (value) ;}, message: 'incorrect zip code format '}, ip: {// verify ip address validator: function (value) {return/d +. d +. d +. d +/I. test (value) ;}, message: 'IP address format incorrect '}, name: {// verify name, which can be Chinese or English validator: function (value) {return/^ [\ u0391-\ uFFE5] + $/I. test (value) |/^ \ w + [\ w \ s] + \ w + $/I. test (value) ;}, message: 'enter your name'}, carNo: {v Alidator: function (value) {return/^ [\ u4E00-\ u9FA5] [\ da-zA-Z] {6} $ /. test (value) ;}, message: 'invalid license plate number (e.g. Guangdong J12350) '}, carenergin: {validator: function (value) {return/^ [a-zA-Z0-9] {16} $ /. test (value) ;}, message: 'invalid engine model (for example, FG6H012345654584) '}, email: {validator: function (value) {return/^ \ w + ([-+.] \ w +) * @ \ w + ([-.] \ w + )*\. \ w + ([-.] \ w +) * $ /. test (value) ;}, message: 'enter a valid email account (e.g.: abc@126.com)'}, msn: {validator: fun Ction (value) {return/^ \ w + ([-+.] \ w +) * @ \ w + ([-.] \ w + )*\. \ w + ([-.] \ w +) * $ /. test (value) ;}, message: 'enter a valid msn account (for example, abc @ hotnail (msn/live ). com) '}, same: {validator: function (value, param) {if ($ ("#" + param [0]). val ()! = "" & Value! = "") {Return $ ("#" + param [0]). val () = value ;}else {returntrue ;}, message: 'The passwords entered twice are inconsistent! '}});
Related Article

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.