CRM-17013 - Only use submitOnce on fullscreen forms
authorColeman Watts <coleman@civicrm.org>
Fri, 21 Aug 2015 20:20:11 +0000 (16:20 -0400)
committerColeman Watts <coleman@civicrm.org>
Sat, 22 Aug 2015 17:12:32 +0000 (13:12 -0400)
CRM/Contact/Form/Task/EmailCommon.php
templates/CRM/Contact/Form/Task/EmailCommon.js

index e36ed8646c71d5c40f216988f51dea992078c17a..1bd823505d95941418c77246e5aa74ef5ea20b84 100644 (file)
@@ -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');
   }
 
   /**
index 456a2216891c0d389471ef0667db859dedee852b..d74287631ab205bc306a7ab37ebf62a588da660c 100644 (file)
@@ -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);
    });
 });