在按下对话框“保存”按钮后创建对话框确认
Creating a dialog confirmation after a dialog 'save' button is pressed
我有一个jquery对话框窗口,用户可以在其中配置具有不同要求的新服务器。现在,当用户单击"保存"时,我们希望打开一个确认窗口以确认用户是否要执行此操作。
我主要关心的是这是一个对话框中的对话框。
下面是对话框的代码
$('#newenvironment').dialog({
autoOpen: false,
buttons: {
'Save': function() {
var url = "./environment/new/";
// There is code here that processes the fields
// code to send the data to the server
// URL gets built
c.post(url);
$('#newenvironment').dialog('close');
},
'Cancel': function() {
$('#newenvironment').dialog('close');
}
},
modal: true,
width: 640
});
谢谢:)
您可以执行以下操作:
.HTML:
<div id="mainDialog">
<div id="area">
<h2>Server requirements </h2>
Enter something: <input type="text" name="yada"/>
<div>
</div>
<div id="confirmDialog">Are you sure?</div>
Javascript:
$("#confirmDialog").dialog({
height: 250,
modal: true,
autoOpen: false,
buttons: {
"Yes": function() {
$(this).dialog("close");
// show some sort of busy indicator here
var url = "./environment/new";
// code to process inputs from main dialog
//c.post(url);
// clear busy indicator here
},
"No": function() {
$(this).dialog("close");
$("#mainDialog").dialog("open");
}
}
});
$("#mainDialog").dialog({
height:350,
modal: true,
autoOPen: false,
buttons: {
"Save": function() {
$(this).dialog("close");
$("#confirmDialog").dialog("open");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
这将在显示确认对话框时关闭主对话框,如果未确认,请重新打开它。或者,您可以在确认对话框打开时使主对话框保持打开状态。在这种情况下,主对话框将被阻止,直到用户退出确认对话框。
相关文章:
- if语句中的jQuery UI对话框按钮
- 动态覆盖jqueryUI对话框按钮(保存,取消等到用户选择)文本
- AJAX 未在对话框按钮单击上运行
- 设置 jQuery UI 对话框按钮 ID
- 如何在 jQuery UI 对话框按钮单击中提供钩子
- Teleriks RadWindow 确认对话框按钮事件未触发的任何原因
- 为jquery对话框按钮添加样式
- 窗体围绕jquery对话框按钮
- jquery对话框按钮太多
- 单击“确认”对话框按钮时,如何返回true或false
- jqueryui表单提交按钮和使用对话框按钮
- 如何在Jquery UI对话框按钮调用上调用Jquery Ajax函数
- Facebook流发布对话框按钮事件在IE中不起作用
- 如何在一些调用函数中传递jquery对话框按钮函数的返回值
- 如何修改jquery对话框按钮
- 禁用struts jquery对话框按钮打开
- 如何样式对话框按钮在NativeScript
- 创建时访问jQueryUI对话框按钮
- Mozilla XUL -对话框按钮'
- 点击“取消”后的页面重定向确认对话框按钮