Easyui Learning Note 14-expanded basic validation rules

Source: Internet
Author: User
Tags email account

/** * Extended basic Check rules,*/$.extend ($.fn.validatebox.defaults.rules, {minLength: {//judging the minimum lengthValidator:function(value, param) {value= $.trim (value);//Go to Space            returnValue.length >= param[0]; }, Message:' Enter a minimum of {0} characters. ‘}, Length:{validator:function(value,param) {varlen=$.trim (value). length; returnLen>=param[0]&&len<=param[1]; }, Message:"Input size is incorrect"}, Phone: {//Verify phone numberValidator: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:' Format is incorrect, use the following format: 020-88888888 '}, Mobile: {//Verify your phone numberValidator:function(value) {return/^ (13|15|18) \d{9}$/i.test (value); }, Message:' Cell phone number format is incorrect '}, Idcard: {//Verify IDValidator:function(value) {return/^\D{15} (\d{2}[a-za-z0-9])? $/i.test (value); }, Message:' ID card number format is incorrect '}, Intorfloat: {//validating integers or decimalsValidator:function(value) {return/^\d+ (\.\d+)? $/i.test (value); }, Message:' Please enter a number and make sure the format is correct '}, Currency: {//Verify CurrencyValidator:function(value) {return/^\d+ (\.\d+)? $/i.test (value); }, Message:' Currency format is incorrect '}, QQ: {//verify QQ, starting from 10000Validator:function(value) {return/^[1-9]\d{4,9}$/i.test (value); }, Message:' QQ number format is incorrect '}, Integer: {//Validating integersValidator:function(value) {return/^[+]? [1-9]+\d*$/i.test (value); }, Message:' Please enter an integer '}, Chinese: {//Verify ChineseValidator:function(value) {return/^[\u0391-\uffe5]+$/i.test (value); }, Message:' Please input Chinese '}, 中文版: {//Verify EnglishValidator:function(value) {return/^[a-za-z]+$/i.test (value); }, Message:' Please input in English '}, Unnormal: {//Verify that you include spaces and illegal charactersValidator:function(value) {return/.+/i.test (value); }, Message:' Input value cannot be empty and contains other illegal characters '}, Username: {//Verify user nameValidator:function(value) {return/^[a-za-z][a-za-z0-9_]{5,15}$/i.test (value); }, Message:' User name not in law (start with a letter, allow 6-16 bytes, allow alphanumeric underline) '}, Faxno: {//Verifying FaxesValidator: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:' Fax number is incorrect '}, Zip: {//Verify postal CodeValidator:function(value) {return/^[1-9]\d{5}$/i.test (value); }, Message:' ZIP code format is incorrect '}, IP: {//Verify IP AddressValidator:function(value) {return/d+.d+.d+.d+/i.test (value); }, Message:' IP address format is incorrect '}, Name: {//verify the name, either in Chinese or EnglishValidator:function(value) {return/^[\u0391-\uffe5]+$/i.test (value) |/^\w+[\w\s]+\w+$/i.test (value); }, Message:' Please enter your name '}, carno:{Validator:function(value) {return/^[\u4e00-\u9fa5][\da-za-z]{6}$/. Test (value); }, Message:' Invalid license plate number (example: Yue J12350) '}, carenergin:{Validator:function(value) {return/^[a-za-z0-9]{16}$/. Test (value); }, Message:' Engine model not valid (example: fg6h012345654584) '}, email:{Validator:function(value) {return/^\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$/. Test (value); }, Message:' Please enter a valid email account (example: [email protected]) '}, msn:{Validator:function(value) {return/^\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$/. Test (value); }, Message:' Please enter a valid MSN account (example: [email protected] (msn/live). com) '}, same:{Validator:function(value, param) {if($ ("#" +param[0]). val ()! = "" && Value! = ""){                 return$ ("#" +param[0]). val () = =value; }Else{                 return true; }}, message:' Two times the password entered is inconsistent! ‘}, Warnmintime: {//the value of the judging alarm can only be increased at the first level, the minimum valueValidator:function(value, param) {value= $.trim (value);//Go to Space            if(Value! = "")             for(vari=0;i<param.length; i++) {$ (Param[i]). Val (); if($ (Param[i]). ComboBox (' GetValue ')){                    varTemp=$.trim ($ (Param[i]). ComboBox (' GetValue ')); if(Temp! = "" &&!isnan (temp) && parseint (value) <=parseint (temp))return false; }            }            return true; }, Message:' cannot be less than the alarm time of the previous level of the current alarm '}, Warnmaxtime: {//the value of the judging alarm can only be increased at the first level, the maximum valueValidator:function(value, param) {value= $.trim (value);//Go to Space            if(Value! = "")             for(vari=0;i<param.length; i++) {$ (Param[i]). Val (); if($ (Param[i]). ComboBox (' GetValue ')){                    varTemp=$.trim ($ (Param[i]). ComboBox (' GetValue ')); if(Temp! = "" &&!isnan (temp) && parseint (value) >=parseint (temp))return false; }            }            return true; }, Message:' cannot be greater than the alarm time at the rear level of the current alarm '}, Comparedate: {validator:function(value, param) {returnDatecompare ($ (param[0]). Datetimebox (' GetValue '), value);//Notice how the Easyui time control gets the value}, Message:' Start date cannot be greater than end Date '        },});
Customer Phone:<input type= "text" name= "phone"  class= "easyui-validatebox textbox" data-options= "required: True,validtype: ' Integer ' "  validtype=" mobile "/>

Easyui Learning Note 14-expanded basic validation rules

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.