Sugarcrm 在离开前禁用确认弹出窗口
Sugarcrm disable confirm popup before leaving
当表单发生一些变化时,如果用户尝试导航到其他页面,sugarcrm 会在弹出窗口中要求确认是否离开。
如何在 sugarcrm 7 中禁用此功能?
更新
实际上我正在导出一个 csv。第一次单击按钮时会下载文件。
当我第二次单击该按钮时,它会显示附件中的确认弹出窗口。
注释掉 CloseActivityPanel
函数中的所有内容,注释后您的代码将仅如下所示:
closeActivityPanel: {
show:function(module,id,new_status,viewType,parentContainerId){
if (SUGAR.util.closeActivityPanel.panel)
SUGAR.util.closeActivityPanel.panel.destroy();
var singleModule = SUGAR.language.get("app_list_strings", "moduleListSingular")[module];
singleModule = typeof(singleModule != 'undefined') ? singleModule.toLowerCase() : '';
var closeText = SUGAR.language.get("app_strings", "LBL_CLOSE_ACTIVITY_CONFIRM").replace("#module#",singleModule);
var args = "action=save&id=" + id + "&record=" + id + "&status=" + new_status + "&module=" + module;
var callback = {
success:function(o)
{
window.setTimeout(function(){if(document.getElementById('search_form')) document.getElementById('search_form').submit(); else window.location.reload(true);}, 0);
},
argument:{'parentContainerId':parentContainerId}
};
YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, args);
}
},
这样确认pop就不会来了
如果您想禁用 onbeforeunload
,请根据您的要求使用以下代码。
$(document).on("submit", "form", function(event){
window.onbeforeunload = null;
});
当表单发生一些变化时,如果用户尝试导航到其他页面,sugarcrm 会在弹出窗口中要求确认是否离开。
如何在 sugarcrm 7 中禁用此功能?
更新
实际上我正在导出一个 csv。第一次单击按钮时会下载文件。
当我第二次单击该按钮时,它会显示附件中的确认弹出窗口。
注释掉 CloseActivityPanel
函数中的所有内容,注释后您的代码将仅如下所示:
closeActivityPanel: {
show:function(module,id,new_status,viewType,parentContainerId){
if (SUGAR.util.closeActivityPanel.panel)
SUGAR.util.closeActivityPanel.panel.destroy();
var singleModule = SUGAR.language.get("app_list_strings", "moduleListSingular")[module];
singleModule = typeof(singleModule != 'undefined') ? singleModule.toLowerCase() : '';
var closeText = SUGAR.language.get("app_strings", "LBL_CLOSE_ACTIVITY_CONFIRM").replace("#module#",singleModule);
var args = "action=save&id=" + id + "&record=" + id + "&status=" + new_status + "&module=" + module;
var callback = {
success:function(o)
{
window.setTimeout(function(){if(document.getElementById('search_form')) document.getElementById('search_form').submit(); else window.location.reload(true);}, 0);
},
argument:{'parentContainerId':parentContainerId}
};
YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, args);
}
},
这样确认pop就不会来了
如果您想禁用 onbeforeunload
,请根据您的要求使用以下代码。
$(document).on("submit", "form", function(event){
window.onbeforeunload = null;
});