From b2a909a5dbc60ca3009f10b7588104d01177eb18 Mon Sep 17 00:00:00 2001 From: Steph Date: Wed, 13 Dec 2023 09:49:53 -0500 Subject: [PATCH] add check for document.visibilityState --- .../apps/cloudcare/static/cloudcare/js/form_entry/form_ui.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/corehq/apps/cloudcare/static/cloudcare/js/form_entry/form_ui.js b/corehq/apps/cloudcare/static/cloudcare/js/form_entry/form_ui.js index 567dc116d699..507573f3d94a 100644 --- a/corehq/apps/cloudcare/static/cloudcare/js/form_entry/form_ui.js +++ b/corehq/apps/cloudcare/static/cloudcare/js/form_entry/form_ui.js @@ -488,6 +488,11 @@ hqDefine("cloudcare/js/form_entry/form_ui", function () { }); self.submitForm = function () { + $(document).onvisibilitychange = () => { + if (document.visibilityState === "hidden") { + self.showSubmitButton = false; + } + }; self.hasSubmitAttempted(true); $.publish('formplayer.' + constants.SUBMIT, self); };