数据验证
<script>
//数据验证参数配置
$.validator.setDefaults({
highlight: function (e) {
$(e).closest(".form-group").removeClass("has-success").addClass("has-error")
},
success: function (e) {
e.closest(".form-group").removeClass("has-error").addClass("has-success")
},
errorElement: "span",
errorPlacement: function (e, r) {
e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
},
errorClass: "help-block m-b-none",
validClass: "m-b-none"
})
//数据验证 业务逻辑
$(function () {
var e = "<i class='fa fa-times-circle'></i> ";
$("#signupForm").validate({
rules: {
CityID: "required",
ClassName: "required",
ComName: "required",
LogisticsRange: "required",
ContactsName: "required",
Position: "required",
PhoneNumber: "required",
Address: "required"
},
messages: {
CityID: e + "请选择物业公司",
ClassName: e + "请输入类别名称",
ComName: e + "请输入物流公司名称",
LogisticsRange: e + "请选择相关物流业务经营范围",
ContactsName: e + "请输入联系人",
Position: e + "请输入职业",
PhoneNumber: e + "请输入手机号",
Address: e + "请输入住址",
}
, submitHandler: function () {//执行
AddorUpdate()
}
})
})
</script>