From a1ea90696a69659b7744c42212c58192d21493c6 Mon Sep 17 00:00:00 2001 From: colemanw Date: Mon, 23 Oct 2023 13:55:52 -0400 Subject: [PATCH] Afform - Improve error handling during form submission --- ext/afform/core/ang/af/afForm.component.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/afform/core/ang/af/afForm.component.js b/ext/afform/core/ang/af/afForm.component.js index 00fb929047..e06b79dff0 100644 --- a/ext/afform/core/ang/af/afForm.component.js +++ b/ext/afform/core/ang/af/afForm.component.js @@ -14,6 +14,7 @@ status, args, submissionResponse, + ts = CRM.ts('org.civicrm.afform'), ctrl = this; this.$onInit = function() { @@ -112,7 +113,8 @@ $element.trigger('crmFormSuccess', { afform: metaData, - data: data + data: data, + submissionResponse: submissionResponse, }); status.resolve(); @@ -197,10 +199,9 @@ } }) .catch(function(error) { - status.resolve(); - status = CRM.status(error.error_message, 'error'); + status.reject(); $element.unblock(); - CRM.alert(error.error_message, ts('Form Error')); + CRM.alert(error.error_message || '', ts('Form Error')); }); }; } -- 2.25.1