From 50b4067299447d5b9f1c0ce67f10ae6c1ad2a655 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 19 Apr 2021 10:09:49 -0600 Subject: [PATCH] Add handling for confirm on button click that better matches normal execution path This works better for buttons that are in a namespace --- api/js/etemplate/et2_widget_dialog.js | 5 +++++ api/js/etemplate/et2_widget_dialog.ts | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/et2_widget_dialog.js b/api/js/etemplate/et2_widget_dialog.js index e28e7f9341..018ba92ea8 100644 --- a/api/js/etemplate/et2_widget_dialog.js +++ b/api/js/etemplate/et2_widget_dialog.js @@ -537,6 +537,11 @@ var et2_dialog = /** @class */ (function (_super) { if (_postSubmit) { senders.getRoot().getInstanceManager().postSubmit(buttonId); } + else if (senders.instanceOf(et2_widget_button_1.et2_button) && senders.getType() !== "buttononly") { + senders.clicked = true; + senders.getInstanceManager().submit(senders, false, senders.options.novalidate); + senders.clicked = false; + } else { senders.getRoot().getInstanceManager().submit(buttonId); } diff --git a/api/js/etemplate/et2_widget_dialog.ts b/api/js/etemplate/et2_widget_dialog.ts index dd5c1d0c0c..3f35a25112 100644 --- a/api/js/etemplate/et2_widget_dialog.ts +++ b/api/js/etemplate/et2_widget_dialog.ts @@ -699,9 +699,18 @@ export class et2_dialog extends et2_widget { var egw = _senders instanceof et2_widget ? _senders.egw() : et2_dialog._create_parent().egw(); var callbackDialog = function (button_id) { if (button_id == et2_dialog.YES_BUTTON) { - if (_postSubmit) { - senders.getRoot().getInstanceManager().postSubmit(buttonId); - } else { + if (_postSubmit) + { + senders.getRoot().getInstanceManager().postSubmit(buttonId); + } + else if (senders.instanceOf(et2_button) && senders.getType() !== "buttononly") + { + senders.clicked = true; + senders.getInstanceManager().submit(senders, false, senders.options.novalidate); + senders.clicked = false; + } + else + { senders.getRoot().getInstanceManager().submit(buttonId); } }