From: Coleman Watts Date: Fri, 21 Aug 2015 20:20:11 +0000 (-0400) Subject: CRM-17013 - Only use submitOnce on fullscreen forms X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e573fefc22bf9f1485671710c12c9753704e1c40;p=civicrm-core.git CRM-17013 - Only use submitOnce on fullscreen forms --- diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index e36ed8646c..1bd823505d 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -314,7 +314,7 @@ class CRM_Contact_Form_Task_EmailCommon { } $form->addFormRule(array('CRM_Contact_Form_Task_EmailCommon', 'formRule'), $form); - CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js'); + CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js', 0, 'html-header'); } /** diff --git a/templates/CRM/Contact/Form/Task/EmailCommon.js b/templates/CRM/Contact/Form/Task/EmailCommon.js index 456a221689..d74287631a 100644 --- a/templates/CRM/Contact/Form/Task/EmailCommon.js +++ b/templates/CRM/Contact/Form/Task/EmailCommon.js @@ -1,14 +1,14 @@ CRM.$(function($) { //do not copy & paste this - find a way to generalise it 'use strict'; - // NOTE: Might be safer to say $('[name=_qf_Email_upload]') - $('.crm-form-submit').not('.cancel').on("click", function() { - $('.crm-form-submit').not('.cancel').attr({value: ts('Processing')}); + // NOTE: Target only fullscreen forms (using #crm-container as context) because popups already have this feature + $('.crm-form-submit', '#crm-container').not('.cancel').on("click", function() { + $('.crm-form-submit', '#crm-container').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(){ - $('.crm-form-submit').not('.cancel').prop({disabled: true}); + $('.crm-form-submit', '#crm-container').not('.cancel').prop({disabled: true}); }, 0); }); });