bootstrap的验证和确认对话框

更新时间:2023-05-12 10:28:20 阅读: 评论:0

bootstrap的验证和确认对话框
引⽤
<!-- jquery-confirm.确认对话框 -->
<link href="~/asts/dist/css/jquery-confirm.min.css" rel="stylesheet"/>
<script src="~/asts/dist/js/jquery-confirm.min.js"></script>
<!-- bootstrapValidator.验证 -->
<link href="~/asts/dist/css/bootstrapValidator.min.css" rel="stylesheet"/>
<script src="~/asts/dist/js/bootstrapValidator.js"></script>
JS
<script>
$('#formMenu').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
urname: {
message: 'The urname is not valid',
validators: {
notEmpty: {
message: 'The urname is required and cannot be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The urname must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The urname can only consist of alphabetical, number and underscore'
}
}
},
email: {
validators: {
notEmpty: {
message: 'The email is required and cannot be empty'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
},
}
}).on('success.form.bv', function (e) {
//验证成功
$.confirm({
confirmButtonClass: 'btn-info',
cancelButtonClass: 'btn-danger',
cancelButtonClass: 'btn-danger',
title: '保存',
content: '请确认,是否保存?',
confirm: function () {
$.ajax({
url: "/Menu/save",
type: "post",
data: $('#formMenu').rialize(),
success: function (data) {
$("#myModal").modal("hide");
load(null, fal);
}
});
this.clo();
},
});
});
//保存
$('#save').on('click', function () {
//开启验证
$('#formMenu').bootstrapValidator('validate');    })
</script>

本文发布于:2023-05-12 10:28:20,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/105587.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:确认   验证   对话框   是否   保存
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图