diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index caf285c01d1b3512235d4b170bafc9d469d25e68..ca503ddb90609cd4442b8608306e961b4ba4f4dd 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -121,8 +121,6 @@ class CRM_Contact_Form_Task_EmailCommon { * * @access public * - * @param $form - * * @return void */ static function buildQuickForm(&$form) { @@ -272,7 +270,6 @@ class CRM_Contact_Form_Task_EmailCommon { } $form->addFormRule(array('CRM_Contact_Form_Task_EmailCommon', 'formRule'), $form); - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Core/Form.js'); CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js'); } @@ -310,8 +307,6 @@ class CRM_Contact_Form_Task_EmailCommon { * * @access public * - * @param $form - * * @return None */ static function postProcess(&$form) { diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 2e33e17a6956985d0137183fd3d03d15734fe68d..3363a49b0290e9956e9f2c0a03b5cc54454108cc 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -494,6 +494,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr 'name' => $contribButton, 'spacing' => ' ', 'isDefault' => TRUE, + 'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"), ), array( 'type' => 'back', @@ -556,8 +557,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->setDefaults($defaults); $this->freeze(); - - parent::buildQuickForm(); } /** diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 190ccdc8f31164afb70cce6c6d5d3e4702fd2644..358a90de472e636c6d77f5795d0f043352496c86 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -556,7 +556,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } $this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this); - parent::buildQuickForm(); } /** diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index e81c6f42baddf212259b2881d3ad345d75db534e..5167ab339dbf02bae15e1837e61ee0d10c0ee761 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -285,14 +285,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @return void * */ - function buildQuickForm() { - // @todo less cautious approach would be to add this to addButtons. - // it would be good to make this switch at the early stage of a release cycle. - // @ the moment of the 106 uses of parent::buildQuickForm only a handle are direct descendents - // of this class - including the contribution forms per CRM-13397 & the (tested) sms provider form. - //(I checked maybe another 20 directly that weren't & was also able to rule out about 40 more by virtue of common patterns - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Core/Form.js'); - } + function buildQuickForm() {} /** * This virtual function is used to set the default values of @@ -405,10 +398,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $js = CRM_Utils_Array::value('js', $button); $isDefault = CRM_Utils_Array::value('isDefault', $button, FALSE); if ($isDefault) { - $attrs = array('class' => 'form-submit default crm-form-button-' . $button['type']); + $attrs = array('class' => 'form-submit default'); } else { - $attrs = array('class' => 'form-submit crm-form-button-' . $button['type']); + $attrs = array('class' => 'form-submit'); } if ($js) { diff --git a/js/Common.js b/js/Common.js index 8770917b036466d8502b10a72772dee06021924f..efd5140b2c1f6b796e66bd8d55adb14b394ade16 100644 --- a/js/Common.js +++ b/js/Common.js @@ -396,13 +396,8 @@ function unselectRadio(fieldName, form) { * @return null */ var submitcount = 0; -/** - * @deprecated - * Changes button label on submit, and disables button after submit for newer browsers. - * Puts up alert for older browsers. - * @todo CRM-13397 replaces this with an alternate (jquery) mechanism - to use the jquery mechanism add - * parent::buildQuickForm to make buttons 'protected' - * */ +/* Changes button label on submit, and disables button after submit for newer browsers. + Puts up alert for older browsers. */ function submitOnce(obj, formId, procText) { // if named button clicked, change text if (obj.value != null) { diff --git a/templates/CRM/Contact/Form/Task/EmailCommon.js b/templates/CRM/Contact/Form/Task/EmailCommon.js index 1c4dfa0f0235645f8ad269591f1eae9cf09a6c4f..bb7610e4c909b21dd44172ace5c3e43993d660e6 100644 --- a/templates/CRM/Contact/Form/Task/EmailCommon.js +++ b/templates/CRM/Contact/Form/Task/EmailCommon.js @@ -2,4 +2,14 @@ cj(function ($) { //do not copy & paste this - find a way to generalise it 'use strict'; $().crmAccordions(); + // NOTE: Might be safer to say $('[name=_qf_Email_upload]') + $('.form-submit').not('.cancel').on("click", function() { + $('.form-submit').not('.cancel').attr({value: ts('Processing')}); + // CRM-13449 : setting a 0 ms timeout is needed + // for some browsers like chrome. Used for purpose of + // submit the form and stop accidental multiple clicks + setTimeout(function(){ + $('.form-submit').not('.cancel').attr({disabled: 'disabled'}); + }, 0); + }); }); diff --git a/templates/CRM/Core/Form.js b/templates/CRM/Core/Form.js deleted file mode 100644 index 4b27202a6e5f900b2e27961bce5d5d1030a0da09..0000000000000000000000000000000000000000 --- a/templates/CRM/Core/Form.js +++ /dev/null @@ -1,15 +0,0 @@ -cj(function ($) { - 'use strict'; - $('.form-submit').on("click", function() { - $('.form-submit').attr({value: ts('Processing'), disabled : 'disabled'}); - $('.crm-form-button-back ').closest('span').hide(); - $('.crm-form-button-cancel').closest('span').hide(); - // CRM-13449 : setting a 0 ms timeout is needed - // for some browsers like chrome. Used for purpose of - // submit the form and stop accidental multiple clicks - setTimeout(function(){ - $('.form-submit').not('.cancel').attr({disabled: 'disabled'}); - }, 0); - }); -}); -