$(function () { //自定义jQuery 校验 jQuery.validator.addMethod("isFloat5Fn",function(value,element){ return this.optional(element) || /^\d+(\.\d{1,5})?$/.test(value); },"小数点后最多5位小数"); /*自定义jQuery校验是9位数字和字母*/ jQuery.validator.addMethod("LetterAndNum9",function(value,element){ return this.optional(element) || /^[a-zA-Z0-9]{9}$/.test(value); },"组织机构代码由9位数字或字母组成"); //保存企业信息 $("#form-information-edit").validate({ rules: { name: { required: true, minlength: 1, maxlength: 64, remote: { url: pagePath + "/company/companyInfoManage/isExistCompanyName", type: "get", data: { company_name: function () { return $("#company_name").val(); }, id: '' } } }, /*organization_code: { required: true, minlength: 1, maxlength: 60, remote: { url: pagePath + "/company/companyInfoManage/getOrganization_code", type: "get", data: { organization_code: function () { return $("#organization_code").val(); }, id: function () { return $("#companyId").val(); } } }, LetterAndNum9:$("#organization_code").val(), },*/ value: { required: true, minlength: 1, maxlength: 64 }, registration_capital: { minlength: 1, maxlength: 14, number:true, isFloat:$("#registration_capital").val(), isFloat5Fn:$("#registration_capital").val() }, }, messages: { company_name: { remote: "该公司名已存在!" },organization_code: { remote: "该组织机构代码已存在!" } }, onkeyup: false, focusCleanup: true, success: "valid", submitHandler: function (form) { // $(form).find(":submit").attr("disabled", true); $(form).ajaxSubmit({ type: 'post', url: pagePath + "/company/companyInfoManage/editInfo/" + $("#companyId").val(), dataType: "json", success: function (data) { if (data.success) { succeedMessage(data.message); setTimeClose(); } else { // $(form).find(":submit").attr("disabled", false); errorMessage(data.message); } }, error: function () { errorMessage('系统错误!'); } }); return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。 } }); }); /* 参数解释: title 标题 url 请求的url id 需要操作的数据id w 弹出层宽度(缺省调默认值) h 弹出层高度(缺省调默认值) */ /*管理员-增加*/ function addFiles(title, url, w, h) { //var index = layer_show(title, pagePath+url, w, h); //默认全屏 //layer.full(index); layer_show(title, pagePath+url, w, h); }