*
* @access public
*
- * @param $form
- *
* @return void
*/
static function buildQuickForm(&$form) {
}
$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');
}
*
* @access public
*
- * @param $form
- *
* @return None
*/
static function postProcess(&$form) {
'name' => $contribButton,
'spacing' => ' ',
'isDefault' => TRUE,
+ 'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"),
),
array(
'type' => 'back',
$this->setDefaults($defaults);
$this->freeze();
-
- parent::buildQuickForm();
}
/**
}
$this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this);
- parent::buildQuickForm();
}
/**
* @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
$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) {
* @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) {
//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);
+ });
});
+++ /dev/null
-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);
- });
-});
-