From baa2d85c7f24e1f285e9d4b8f36d57c8c63e938c Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 29 Apr 2014 18:45:19 -0700 Subject: [PATCH] CRM-14215 - Fix popup form errors --- CRM/Contribute/Form/Contribution/Main.php | 1 - CRM/Core/Form.php | 2 +- CRM/Core/QuickForm/Action/Display.php | 3 ++- templates/CRM/Form/body.tpl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 15f5f46975..a22de0aa15 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -1311,7 +1311,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu */ static function preProcessPaymentOptions(&$form, $noFees = FALSE) { $form->_snippet = CRM_Utils_Array::value('snippet', $_GET); - $form->assign('snippet', $form->_snippet); $form->_paymentProcessors = $noFees ? array() : $form->get('paymentProcessors'); $form->_ppType = NULL; diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 28d262bdca..0a0b08c5cd 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -174,7 +174,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { self::$_template = CRM_Core_Smarty::singleton(); } - $this->assign('snippet', (int) CRM_Utils_Array::value('snippet', $_REQUEST)); + $this->assign('snippet', CRM_Utils_Array::value('snippet', $_REQUEST)); } static function generateID() { diff --git a/CRM/Core/QuickForm/Action/Display.php b/CRM/Core/QuickForm/Action/Display.php index 865e127873..a18581d7fa 100644 --- a/CRM/Core/QuickForm/Action/Display.php +++ b/CRM/Core/QuickForm/Action/Display.php @@ -126,7 +126,8 @@ class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action { $template->assign('isForm', 1); $controller = &$page->controller; - if ($controller->getEmbedded()) { + // Stop here if we are in embedded mode. Exception: displaying form errors via ajax + if ($controller->getEmbedded() && !(!empty($form['errors']) && $controller->_QFResponseType == 'json')) { return; } diff --git a/templates/CRM/Form/body.tpl b/templates/CRM/Form/body.tpl index d0446f81df..58e860fc64 100644 --- a/templates/CRM/Form/body.tpl +++ b/templates/CRM/Form/body.tpl @@ -33,7 +33,7 @@
{$form.hidden}
{/if} -{if ($snippet eq 0 or $snippet neq 'json') and !$suppressForm and count($form.errors) gt 0} +{if ($snippet !== 'json') and !$suppressForm and count($form.errors) gt 0}
{ts}Please correct the following errors in the form fields below:{/ts} -- 2.25.1