From 0f0925b04bbab9e936c4bd36c59d67925f68d8c3 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 23 Jul 2015 12:15:06 -0400 Subject: [PATCH] CRM-16872 - Ensure errors are displayed from semi-ajax forms --- js/crm.ajax.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/crm.ajax.js b/js/crm.ajax.js index dfcebaeba4..7c180cd724 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -272,6 +272,14 @@ that._handleOrderLinks(); that.element.trigger('crmLoad', data); if (that.options.crmForm) that.element.trigger('crmFormLoad', data); + // This is only needed by forms that load via ajax but submit without ajax, e.g. configure contribution page tabs + // TODO: remove this when those forms have been converted to use ajax submit + if (data.status === 'form_error' && $.isPlainObject(data.errors)) { + that.element.trigger('crmFormError', data); + $.each(data.errors, function(formElement, msg) { + $('[name="'+formElement+'"]', that.element).crmError(msg); + }); + } }).fail(function(data, msg, status) { that._onFailure(data, status); }); -- 2.25.1