From 61189839155b0e992253b8bc8c8b9cef6fb752cc Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 22 Oct 2013 15:17:45 -0700 Subject: [PATCH] CRM-13397 - Contribte - Add submitOnce behavior to contribute button when confirmation page is disabled ---------------------------------------- * CRM-13397: Protection against multiple submits on contributions page doesn't work when confirmation page is turned off http://issues.civicrm.org/jira/browse/CRM-13397 --- CRM/Contribute/Form/Contribution/Main.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 358a90de47..898798d2ce 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -544,15 +544,17 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } if (!($allAreBillingModeProcessors && !$this->_values['is_pay_later'])) { - $this->addButtons(array( - array( - 'type' => 'upload', - 'name' => ts('Contribute'), - 'spacing' => '         ', - 'isDefault' => TRUE, - ), - ) + $submitButton = array( + 'type' => 'upload', + 'name' => ts('Contribute'), + 'spacing' => '         ', + 'isDefault' => TRUE, ); + // Add submit-once behavior when confirm page disabled + if (empty($this->_values['is_confirm_enabled'])) { + $submitButton['js'] = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"); + } + $this->addButtons(array($submitButton)); } $this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this); -- 2.25.1