//表单验证
$('#add_form').bootstrapValidator({
message: 'This value is not valid',
ignore: "",
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields:{
pk_customer:{
validators: {
notEmpty: {
message: '选择客户'
}
}},
m_code:{
validators: {
notEmpty: {
message: '物料编码非空'
}
}},
m_name:{
validators: {
notEmpty: {
message: '物料名称非空'
}
}},
m_pack:{
validators: {
notEmpty: {
message: '包装非空'
}
}},
materialspec:{
validators: {
notEmpty: {
message: '物料规格非空'
}
}},
spt_price:{
validators: {
regexp: {//匹配规则
regexp: "^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$",
message: '数字格式'
}
}},
sale_price:{
validators: {
regexp: {//匹配规则
regexp: "^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$",
message: '数字格式'
}
}}
},
excluded: [':disabled'] /*添加该属性*/
});
$('#priceModal').on("hidden.bs.modal", function() {
//$('.form-horizontal')[0].reset();
//$('#add_form').bootstrapValidator('resetForm', false);
$("#add_form").data('bootstrapValidator').resetForm();
});
https://blog.youkuaiyun.com/zero_295813128/article/details/52692277