From e573fefc22bf9f1485671710c12c9753704e1c40 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 21 Aug 2015 16:20:11 -0400 Subject: [PATCH] CRM-17013 - Only use submitOnce on fullscreen forms --- CRM/Contact/Form/Task/EmailCommon.php | 2 +- templates/CRM/Contact/Form/Task/EmailCommon.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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); }); }); -- 2.25.1