Instance resolution jquery Plugin Easyui most common form validation rules _jquery

Source: Internet
Author: User

For example: The validation input box can only be entered between 0-1000 digits with a maximum of 2 decimal digits
form <input type= "text" id= "rate" name= "rate" required= "true" class= "Easyui-validatebox" validtype= " RATECHECK[0,1000] "maxlength=" 6 "/>

$.extend ($.fn.validatebox.defaults.rules, {CHS: {validator:function (value, param) {return/^[\u0391-\uffe 
   5]+$/.test (value); Message: ' Please enter Chinese characters '}, 中文版: {//verify English validator:function (value) {return/^[a-za-z]+$/i.test (value 
   ); Message: ' Enter English '}, IP: {//Verify IP address validator:function (value) {return/\d+\.\d+\.\d+\.\d+/.test (V 
   Alue); Message: ' Incorrect IP address format '}, ZIP: {validator:function (value, param) {return/^[0-9]\d{5}$/.test (value 
   ); Message: ' Postal code does not exist '}, QQ: {validator:function (value, param) {return/^[1-9]\d{4,10}$/.test (value) 
   ; Message: ' QQ number not correct '}, Mobile: {validator:function (value, param) {return/^ (?: 13\d|15\d|18\d)-?\d{ 
   5} (\d{3}|\*{3}) $/.test (value); Message: ' Cell phone number is incorrect '}, tel:{validator:function (value,param) {return/^ (\d{3}-|\d{4}-)? ( \d{8}|\d{7})? 
   (-\d{1,6}) $/.test (value); 
 Message: ' The phone number is incorrect ' }, Mobileandtel: {validator:function (value, param) {return/(^ ([0\+]\d{2,3}) \d{3,4}\-\d{3,8}$) | ( ^ ([0\+]\d{2,3}) \d{3,4}\d{3,8}$ | (^ ([0\+]\d{2,3}) {0,1}13\d{9}$) | (^\d{3,4}\d{3,8}$) | 
   (^\d{3,4}\-\d{3,8}$)/.test (value); Message: ' Please enter the correct phone number '}, #: {validator:function (value, param) {return/^[0-9]+.? 
   [0-9]*$/.test (value); Message: ' Enter Number '}, money:{validator:function (value, param) {return (/^ ([1-9]\d*) |\d) (\.\d{1,2}) 
   ? $/). Test (value); Message: ' Please enter the correct amount '}, mone:{validator:function (value, param) {return (/^ ([1-9]\d*) |\d) (\.\d{1, 
   2})? $/). Test (value); ', message: ' Enter an integer or decimal '}, integer:{validator:function (value,param) {return/^[+]?[ 
   1-9]\d*$/.test (value); Message: ' Please enter an integer minimum of 1 '}, integ:{validator:function (value,param) {return/^[+]?[ 
   0-9]\d*$/.test (value); }, Message: ' Enter Integer '}, range:{validator:function (value,param) {if(/^[1-9]\d*$/.test (value)) 
   {return value >= param[0] && value <= param[1]}else{return false; Message: ' Enter numbers between {0} to {1} '}, minlength:{validator:function (value,param) {return value.length & GT;=PARAM[0]}, message: ' Enter at least {0} characters '}, maxlength:{validator:function (value,param) {return Value.len GTH&LT;=PARAM[0]}, message: ' Up to {0} characters '},//select is the validation selectvalid:{validator:function of the selection box (Value,param 
   {if (value = = Param[0]) {return false; 
   }else{return true; }, message: ' SELECT '}, idcode:{validator:function (value,param) {return/(^\d{15}$) | ( ^\d{18}$) | (^\d{17} (\d| 
   X|X) $/.test (value); Message: ' Please enter the correct ID number '}, LoginName: {validator:function (value, param) {return/^[\u0391-\uffe5\w] 
   +$/.test (value); Message: ' Login name only allows Chinese characters, English letters, numbers, and underscores. '}, Equalto: {validator:function (value, param) {return value = = $ (paraM[0]). Val (); Message: ' Two typed characters are not available to '}, Englishornum: {//can only be entered in English and digital validator:function (value) {return/^[a-za-z0 
   -9_]{1,}$/.test (value); Message: ' Please enter English, number, underline or space '}, xiaoshu:{validator:function (value) {return/^ ([1-9]+) | ( [0-9]+\. [0-9] {1,2})) 
  $/.test (value); Message: ' Keep up to two decimal places!  '}, ddprice:{validator:function (Value,param) {if (/^[1-9]\d*$/.test (value)) {return value >= param[0] 
   && value <= param[1]; 
   }else{return false; }, message: ' Please enter a positive integer from 1 to 100 '}, jretailupperlimit:{validator:function (value,param) {if/^[0-9]+ ([.] {1} [0-9] {1,2})? $/.test (value)) {return parsefloat (value) > parsefloat (param[0]) && parsefloat (value) <= parsefloat (para 
   M[1]); 
   }else{return false; }, message: ' Please enter a number with a maximum of two decimal places between 0 and 100 '}, ratecheck:{validator:function (value,param) {if/^[0-9]+ ([.] {1} [0-9] {1,2})? $/.test (value)) {return parsefloat (Value) > parsefloat (param[0]) && parsefloat (value) <= parsefloat (param[1)); 
   }else{return false;  }, message: ' Please enter a maximum of two decimal digits '}} from 0 to 1000;

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.