From 366f86bc125edbda0df10b1425dae1b13eebc550 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 23 Jun 2023 18:57:01 +0800 Subject: [PATCH] Make buttons in a modal form have proper type. (#25446) Fix #25438 All non-"ok" buttons which do not have "type" should not submit the form, should not be triggered by "Enter". Co-authored-by: silverwind Co-authored-by: Giteabot --- web_src/js/features/common-global.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 46a80beb5185c..e6421b3a2f810 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -345,6 +345,8 @@ export function initGlobalButtons() { if (colorPickers.length > 0) { initCompColorPicker(); } + // all non-"ok" buttons which do not have "type" should not submit the form, should not be triggered by "Enter" + $($(this).attr('data-modal')).find('form button:not(.ok):not([type])').attr('type', 'button'); }); $('.delete-post.button').on('click', function (e) {