From 9df2fd0c80da21c6af5e2a778e21f06735363bd1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 3 Jun 2024 19:29:12 +0300 Subject: [PATCH] Sent onSubmit event when form is submitted successfully --- apps/api/documents/api.js | 1 + apps/common/Gateway.js | 4 ++++ .../forms/app/controller/ApplicationController.js | 1 + apps/documenteditor/main/app/controller/FormsTab.js | 1 + 4 files changed, 7 insertions(+) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 5d9902061c..8e9c567bd7 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -292,6 +292,7 @@ 'onRequestReferenceSource': , // used for external links in sse. must call setReferenceSource method, 'onSaveDocument': 'save document from binary', 'onRequestStartFilling': // used in pdf-form edit mode. must call startFilling method + 'onSubmit': // send when filled form is submitted successfully } } diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index 32da5f2281..5faee33ea8 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -413,6 +413,10 @@ if (window.Common === undefined) { }, data.buffer); }, + submitForm: function() { + _postMessage({event: 'onSubmit'}); + }, + on: function(event, handler){ var localHandler = function(event, data){ handler.call(me, data) diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 176ff4b2ab..76378ee8e3 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -905,6 +905,7 @@ define([ this.view.btnSubmit.setDisabled(!_submitFail); this.view.btnSubmit.cmpEl.css("pointer-events", "auto"); if (!_submitFail) { + Common.Gateway.submitForm(); this.view.btnSubmit.setCaption(this.textFilled); this.view.btnSubmit.cmpEl.removeClass('yellow').removeClass('back-color').addClass('gray'); if (!this.submitedTooltip) { diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index 68461fd455..bfe145b7d4 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -462,6 +462,7 @@ define([ if (id==Asc.c_oAscAsyncAction['Submit'] && this.view.btnSubmit) { Common.Utils.lockControls(Common.enumLock.submit, !this._submitFail, {array: [this.view.btnSubmit]}) if (!this._submitFail) { + Common.Gateway.submitForm(); this.view.btnSubmit.setCaption(this.view.textFilled); if (!this.submitedTooltip) { this.submitedTooltip = new Common.UI.SynchronizeTip({