(function($){ $.fn.validationenginelanguage = function(){ }; $.validationenginelanguage = { newlang: function(){ $.validationenginelanguage.allrules = { "uemail": { "regex": /^(?:[a-z\d]+[_\-\+\.]?)*[a-z\d]+@(?:([a-z\d]+\-?)*[a-z\d]+\.)+([a-z]{2,})+$/i, "alerttext": "* 无效的邮箱" }, "uphone": { "regex": /^(\d{3,4}-?)?\d{7,8}$/, "alerttext": "* 无效的电话" }, "umobilephone": { "regex": /^0?1\d{10}$/, "alerttext": "* 无效的手机" }, "uusername": { "regex": /^[a-z_]\w{2,20}$/i, "alerttext": "* 无效的注册用户名" }, "uqq": { "regex": /^[0-9]{5,13}$/i, "alerttext": "* 无效的qq号" }, "uip": { "regex": /^(\d{1,3}\.){3}\d{1,3}$/, "alerttext": "* 无效的ip地址" }, "unumber": { "regex": /^\d+$/, "alerttext": "* 仅数字" }, "uword": { "regex": /^[a-za-z]+$/, "alerttext": "* 仅英文字母大小写" }, "required": { // add your regex rules here, you can take telephone as an example "regex": "none", "alerttext": "* 此处不可空白", "alerttextcheckboxmultiple": "* 请选择一个项目", "alerttextcheckboxe": "* 您必须钩选此栏", "alerttextdaterange": "* 日期范围不可空白" }, "requiredinfunction": { "func": function(field, rules, i, options){ return (field.val() == "test") ? true : false; }, "alerttext": "* field must equal test" }, "daterange": { "regex": "none", "alerttext": "* 无效的 ", "alerttext2": " 日期范围" }, "datetimerange": { "regex": "none", "alerttext": "* 无效的 ", "alerttext2": " 时间范围" }, "minsize": { "regex": "none", "alerttext": "* 最少 ", "alerttext2": " 个字符" }, "maxsize": { "regex": "none", "alerttext": "* 最多 ", "alerttext2": " 个字符" }, "grouprequired": { "regex": "none", "alerttext": "* 你必需选填其中一个栏位" }, "min": { "regex": "none", "alerttext": "* 最小值為 " }, "max": { "regex": "none", "alerttext": "* 最大值为 " }, "past": { "regex": "none", "alerttext": "* 日期必需早于 " }, "future": { "regex": "none", "alerttext": "* 日期必需晚于 " }, "maxcheckbox": { "regex": "none", "alerttext": "* 最多选取 ", "alerttext2": " 个项目" }, "mincheckbox": { "regex": "none", "alerttext": "* 请选择 ", "alerttext2": " 个项目" }, "equals": { "regex": "none", "alerttext": "* 请输入与上面相同的密码" }, "creditcard": { "regex": "none", "alerttext": "* 无效的信用卡号码" }, "phone": { // credit: jquery.h5validate.js / orefalo "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, "alerttext": "* 无效的电话号码" }, "mobile": { // credit: jquery.h5validate.js / orefalo "regex": /^(((13[0-9]{1})|(15[0-9]{1})|(14[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/, "alerttext": "* 无效的手机号" }, "email": { // shamelessly lifted from scott gonzalez via the bassistance validation plugin http://projects.scottsplayground.com/email_address_validation/ "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])*([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.)+(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])*([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.?$/i, "alerttext": "* 邮件地址无效" }, "integer": { "regex": /^[\-\+]?\d+$/, "alerttext": "* 不是有效的整数" }, "number": { // number, including positive, negative, and floating decimal. credit: orefalo "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, "alerttext": "* 无效的数字" }, "float": { // number, including positive, negative, and floating decimal. credit: orefalo "regex": /^(-?\d+\.\d+$)|([\-\+]?\d+$)/, "alerttext": "* 无效的数字" }, "date": { "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, "alerttext": "* 无效的日期,格式必需为 yyyy-mm-dd" }, "ipv4": { "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, "alerttext": "* 无效的 ip 地址" }, "url": { "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])*([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.)+(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])*([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\ue000-\uf8ff]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, "alerttext": "* invalid url" }, "onlynumbersp": { "regex": /^[0-9\ ]+$/, "alerttext": "* 只能填数字" }, "onlylettersp": { "regex": /^[a-za-z\ \']+$/, "alerttext": "* 只接受英文字母大小写" }, "onlyletternumber": { "regex": /^[0-9a-za-z]+$/, "alerttext": "* 不接受特殊字符" }, // --- custom rules -- those are specific to the demos, they can be removed or changed to your likings "ajaxusercall": { "url": "ajaxvalidatefielduser", // you may want to pass extra data on the ajax call "extradata": "name=eric", "alerttext": "* 此名称已被其他人使用", "alerttextload": "* 正在确认名称是否有其他人使用,请稍等。" }, "ajaxusercallphp": { "url": "phpajax/ajaxvalidatefielduser.php", // you may want to pass extra data on the ajax call "extradata": "name=eric", // if you provide an "alerttextok", it will show as a green prompt when the field validates "alerttextok": "* 此帐号名称可以使用", "alerttext": "* 此名称已被其他人使用", "alerttextload": "* 正在确认帐号名称是否有其他人使用,请稍等。" }, "ajaxnamecall": { // remote json service location "url": "ajaxvalidatefieldname", // error "alerttext": "* 此名称可以使用", // if you provide an "alerttextok", it will show as a green prompt when the field validates "alerttextok": "* 此名称已被其他人使用", // speaks by itself "alerttextload": "* 正在确认名称是否有其他人使用,请稍等。" }, "ajaxnamecallphp": { // remote json service location "url": "phpajax/ajaxvalidatefieldname.php", // error "alerttext": "* 此名称已被其他人使用", // speaks by itself "alerttextload": "* 正在确认名称是否有其他人使用,请稍等。" }, "validate2fields": { "alerttext": "* 请输入 hello" }, //tls warning:homegrown not fielded "dateformat":{ "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/, "alerttext": "* 无效的日期格式" }, "onlynumberabc_": { "regex": /^(\w){6,18}$/, "alerttext": "6~18个字符,可使用字母、数字、下划线" }, "onlynumberabc_new": { "regex": /^(\w){5,18}$/, "alerttext": "5~18个字符,可使用字母、数字、下划线" }, //tls warning:homegrown not fielded "datetimeformat": { "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|am|pm){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|am|pm){1})$/, "alerttext": "* 无效的日期或时间格式", "alerttext2": "可接受的格式: ", "alerttext3": "mm/dd/yyyy hh:mm:ss am|pm 或 ", "alerttext4": "yyyy-mm-dd hh:mm:ss am|pm" }, "chinazip": { "regex": /^[0-9][0-9]{5}$/, "alerttext": "* 无效的邮政编码" }, "phone_tel": { "regex": /(^(\d{2,4}[-_-―]?)?\d{3,8}([-_-―]?\d{3,8})?([-_-―]?\d{1,7})?$)|(^0?1[35]\d{9}$)/, "alerttext": "* 无效的手机号码或座机号码" }, //用户名 "chknameformat":{ "regex":/^\w{6,18}$/, "alerttext":'用户名格式有误' }, //密码 'chkpwdformat':{ 'regex':/^\w{6,16}$/i, 'alerttext':'密码格式有误' } }; } }; $.validationenginelanguage.newlang(); })(jquery);