This article mainly uses examples to parse the most common verification rules of the jQuery plug-in EasyUI. For more information about EasyUI verification, see:
The verification input box can only contain a maximum of 2 decimal digits between 0 and.
Form
$. Extend ($. fn. validatebox. defaults. rules, {CHS: {validator: function (value, param) {return/^ [\ u0391-\ uFFE5] + $ /. test (value) ;}, message: 'enter Chinese characters '}, english: {// verify english validator: function (value) {return/^ [A-Za-z] + $/I. test (value) ;}, message: 'enter the English'}, ip: {// verify the ip address validator: function (value) {return/\ d + \. \ d + \. \ d + \. \ d + /. test (value) ;}, message: 'IP address format incorrect '}, ZIP: {validator: function (Value, param) {return/^ [0-9] \ d {5} $ /. test (value) ;}, message: 'zip Code does not exist'}, QQ: {validator: function (value, param) {return/^ [1-9] \ d {4, 10} $ /. test (value) ;}, message: 'qq number incorrect '}, mobile: {validator: function (value, param) {return/^ (?: 13 \ d | 15 \ d | 18 \ d )-? \ D {5} (\ d {3} | \ * {3}) $ /. test (value) ;}, message: 'incorrect mobile phone number '}, tel: {validator: function (value, param) {return/^ (\ d {3}-| \ d {4 }-)? (\ D {8} | \ d {7 })? (-\ D {1, 6 })? $ /. Test (value) ;}, message: 'incorrect phone number'}, 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: 'Enter the correct phone number'}, number: {validator: function (value, param) {return/^ [0-9] + .? [0-9] * $ /. test (value) ;}, message: 'Enter the number'}, money: {validator: function (value, param) {return (/^ ([1-9] \ d *) | \ d )(\. \ d {1, 2 })? $ /). Test (value) ;}, message: '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: 'Enter the integer with the minimum value of 1'}, integ: {validator: function (value, param) {return/^ [+]? [0-9] \ d * $ /. test (value) ;}, message: 'enter an integer '}, range: {validator: function (value, param) {if (/^ [1-9] \ d * $ /. test (value) {return value> = param [0] & value <= param [1]} else {return false ;}}, message: 'Enter the number between {0} and {1} '}, minLength: {validator: function (value, param) {return value. length> = param [0]}, message: 'enter at least {0} characters'}, maxLength: {validator: function (value, param) {return value. length <= param [0]}, me Ssage: '{0} characters at most'}, // select indicates the selectValid: {validator: function (value, param) of the select box) {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: 'Enter the correct ID card number '}, loginName: {validator: function (value, param) {return/^ [\ u0391-\ uFFE5 \ w] + $ /. test (value) ;}, message: 'The logon name can only contain Chinese characters, English letters, numbers, and underlines. '}, Failed to: {validator: function (value, param) {return value ==$ (param [0]). val () ;}, message: 'Two input characters are different to '}, englishOrNum: {// only English and numbers can be entered validator: function (value) {return/^ [a-zA-Z0-9 _] {1,} $ /. test (value) ;}, message: 'enter English letters, numbers, underscores, or spaces'}, xiaoshu: {validator: function (value) {return/^ ([1-9] +) | ([0-9] + \. [0-9] {1, 2}) $ /. test (value) ;}, message: 'a maximum of two decimal places can be retained! '}, DdPrice: {validator: function (value, param) {if (/^ [1-9] \ d * $ /. test (value) {return value> = param [0] & value <= param [1] ;}else {return false ;}, message: 'Enter a positive integer between 1 and 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 (param [1]);} else {return false ;}, message: 'enter a maximum of two decimal digits 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: 'enter a maximum of two decimal digits between 0 and 1000 '}});