为什么这些确认模式没有出现
Why these confirmation modal is not showing up?
我使用一个使用bootstrap的模板。我在显示模态时遇到了麻烦。
表单有一个jquery验证,如果一切正常,那么当点击提交时,应该出现一个确认模式,询问用户是否确定要存储该信息。如果表单没有通过验证,则会显示一条简单的消息。对于上述操作,我构建如下:
<form action="#" id="form_sample_2" class="form-horizontal">
<div class="alert alert-error hide">
<button class="close" data-dismiss="alert"></button>Existen errores en el formulario. Por favor verifique.</div>
<!-- modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h3 id="myModalLabel3">Cargar Usuario</h3>
</div>
<div class="modal-body">
<p></p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cerrar</button>
<button data-dismiss="modal" class="btn green" id="btnYes">Confirmar</button>
</div>
</div>
<!-- end modal -->
</form>
正如你所看到的,modal和error message的属性是"hide"…
var handleValidation2 = function () {
// for more info visit the official plugin documentation:
// http://docs.jquery.com/Plugins/Validation
var form2 = $('#form_sample_2');
var error2 = $('.alert-error', form2);
var success2 = $('#myModal', form2);
//IMPORTANT: update CKEDITOR textarea with actual content before submit
form2.on('submit', function () {
for (var instanceName in CKEDITOR.instances) {
CKEDITOR.instances[instanceName].updateElement();
}
})
form2.validate({
errorElement: 'span', //default input error message container
errorClass: 'help-inline', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "",
rules: {
//some code
},
submitHandler: function (form) {
success2.show();
error2.hide();
}
//some code
在这个代码片段中,如果表单没有通过验证,那么error2.hide()函数将显示警告错误消息。
当表单通过验证时,success2.show()函数应该显示确认模式,但它没有这样做。当形式ok时,什么也没有出现,我想知道我做错了什么。
任何帮助都将非常感激。
j .
用success2.modal('show')
代替success2.show();
这应该能解决你的问题
submitHandler: function (form) {
success2.removeAttr('aria-hidden');
success2.show();
error2.hide();
}
是否尝试删除隐藏的变量。
相关文章:
- 弹出格式化的模式对话框,并在用户确认时转发
- 模式警报,但确认按钮未对脚本做出反应
- 确认删除的模式对话框
- Bootstrap3确认模式回调触发两次
- 使用弹出模式中断k-pager-nav以确认/拒绝移动到新页面
- 确认脏表单上的角度模式关闭
- 如何使用 jquery 将变量传递给引导确认模式按钮
- 简单模态 - 如何将电子邮件地址传递给确认模式
- 引导模式确认
- jQuery UI 模式确认对话框,ASP.NET 不会在单击事件中触发
- 用户不会显示 JQuery 模式对话框确认
- 在引导确认模式下控制确认按钮
- 如何在asp.net MVC中创建确认框(模式弹出)
- 使用引导程序验证程序进行验证后,停止表单提交并打开引导模式(确认对话框)
- 确认模式按钮 asp.net 的操作
- 如何跳过确认弹出前卸载和显示我自己的引导模式
- 删除确认 - 打开模式弹出窗口时从 html 传递数据
- Bootstrap 3:添加确认模式框jQuery内联删除行
- 简单确认模式/弹出式-MVC 5/Bootstrap 3
- 如何在jQuery模式确认对话框之后提交表单