Fix JS for input buttons that are now button buttons
authorAndrew Hunt <andrew@aghstrategies.com>
Thu, 6 Aug 2020 20:06:56 +0000 (16:06 -0400)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Mon, 10 Aug 2020 14:38:21 +0000 (15:38 +0100)
js/Common.js
js/crm.ajax.js
js/crm.searchForm.js
templates/CRM/Contact/Form/Search/Builder.js
templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl
templates/CRM/Event/Form/ManageEvent/Registration.tpl
templates/CRM/Mailing/Page/Event.tpl
templates/CRM/Report/Form/Layout/Graph.tpl
templates/CRM/common/TabHeader.js
templates/CRM/common/deferredFinancialType.tpl

index 2474b11b563d887d4cbe7f18bf8180d562698a4e..056c11cfe05919fe5c5181c052e0adb470aaaeaf 100644 (file)
@@ -192,7 +192,7 @@ if (!CRM.vars) CRM.vars = {};
   $.propHooks.disabled = {
     set: function (el, value, name) {
       // Sync button enabled status with wrapper css
-      if ($(el).is('span.crm-button > input.crm-form-submit')) {
+      if ($(el).is('.crm-button.crm-form-submit')) {
         $(el).parent().toggleClass('crm-button-disabled', !!value);
       }
       // Sync button enabled status with dialog button
@@ -971,7 +971,7 @@ if (!CRM.vars) CRM.vars = {};
       $('form[data-submit-once]', e.target)
         .submit(submitOnceForm)
         .on('invalid-form', submitFormInvalid);
-      $('form[data-submit-once] input[type=submit]', e.target).click(function(e) {
+      $('form[data-submit-once] button[type=submit]', e.target).click(function(e) {
         submitButton = e.target;
       });
     })
index e65bd7b2a22c946265f100899d9b50b24a6b6a5c..757ebef0633562eefce72b077e916af2d5b9f155 100644 (file)
         var buttonContainers = '.crm-submit-buttons, .action-link',
           buttons = [],
           added = [];
-        $(buttonContainers, $el).find('input.crm-form-submit, a.button, button').each(function() {
+        $(buttonContainers, $el).find('.crm-form-submit, .crm-form-xbutton, a.button, button').each(function() {
           var $el = $(this),
             label = $el.is('input') ? $el.attr('value') : $el.text(),
             identifier = $el.attr('name') || $el.attr('href');
         $el.dialog('option', 'buttons', buttons);
       }
       // Allow a button to prevent ajax submit
-      $('input[data-no-ajax-submit=true]').click(function() {
+      $('input[data-no-ajax-submit=true], button[data-no-ajax-submit=true]').click(function() {
         $(this).closest('form').ajaxFormUnbind();
       });
       // For convenience, focus the first field
index 42a371dcecf42d18e90d97dae3038d2992d098b7..c84d0f5ec292a549a3378a97b82a656f801b288f 100644 (file)
       // When selecting a task
       .on('change', 'select#task', function(e) {
         var $form = $(this).closest('form'),
-        $go = $('input.crm-search-go-button', $form);
+        $go = $('button.crm-search-go-button', $form);
         var $selectedOption = $(this).find(':selected');
         if (!$selectedOption.val()) {
           // do not blank refresh the empty option.
index fd6a984c13947535d125fd947feb8af9d727ed85..4dc3523571e949d94e59e099d407dcf72bb3e06f 100644 (file)
       })
       // Add new field - if there's a hidden one, show it
       // Otherwise allow form to submit and fetch more from the server
-      .on('click', 'input[name^=addMore]', function() {
+      .on('click', 'button[name^=addMore]', function() {
         var table = $(this).closest('table');
         if ($('tr:hidden', table).length) {
           $('tr:hidden', table).first().show();
index 6ca766cc26b31a2dbd8d4009d9d201ecc68647fd..5a3bd098639cbdae1bbf529889be7cfb22b0570c 100644 (file)
@@ -62,7 +62,7 @@
               <div class="premium-full-title">{$row.name}</div>
               <div class="premium-full-disabled">
                 {ts 1=$row.min_contribution|crmMoney}You must contribute at least %1 to get this item{/ts}<br/>
-                <input type="button" value="{ts 1=$row.min_contribution|crmMoney}Contribute %1 Instead{/ts}" amount="{$row.min_contribution}" />
+                <button type="button" value="{ts 1=$row.min_contribution|crmMoney}Contribute %1 Instead{/ts}" amount="{$row.min_contribution}" />
               </div>
               <div class="premium-full-description">
                 {$row.description}
         amounts.sort(function(a,b){return a - b});
 
         // make contribution instead buttons work
-        $('.premium-full-disabled input').click(function(){
+        $('.premium-full-disabled button').click(function(){
           var amount = Number($(this).attr('amount'));
           if (price_sets[amount]) {
             if (!$(price_sets[amount]).length) {
     {/literal}
   {/if}
 {/if}
-
index 4858e9803259849346fd504d596704290e30d18a..27c4cdb59b21a20a2da34f076a9fc478639a1a34 100644 (file)
@@ -396,7 +396,7 @@ invert              = 0
 <script type="text/javascript">
 {literal}    (function($, _) { // Generic Closure
 
-    $(".crm-submit-buttons input").click( function() {
+    $(".crm-submit-buttons button").click( function() {
       $(".dedupenotify .ui-notify-close").click();
     });
 
index 4636f96d5e1217fa3cbdff9fec5afa6e359c11ea..e54646eaf4cffdb47e7d1c2a344ecdf47202ea78 100644 (file)
@@ -56,7 +56,7 @@
   <script type="text/javascript">
     var totalPages = {/literal}{$pager->_totalPages}{literal};
     CRM.$(function($) {
-      $("#crm-container .crm-pager input.crm-form-submit").click(function () {
+      $("#crm-container .crm-pager button.crm-form-submit").click(function () {
         submitPagerData(this);
       });
     });
index 508d39ca48f2c28866424d515f99f74a548e9360..33eedecb86a40cc9cf2e661392757cc0d1d7d948 100644 (file)
@@ -35,6 +35,7 @@
            createChart( chartID, divName, chartValues.size.xSize, chartValues.size.ySize, allData[chartID].object );
          });
 
+         // FIXME
          $("input[id$='submit_print'],input[id$='submit_pdf']").bind('click', function(e){
            // image creator php file path and append image name
            var url = CRM.url('civicrm/report/chart', 'name=' + '{/literal}{$chartId}{literal}' + '.png');
index e816f0baacd46b33bf5416e39fe6661d2a29a22a..ba514b81268fb2719b1485a598b685f1240a61c7 100644 (file)
@@ -23,7 +23,7 @@ CRM.$(function($) {
           params.autoClose = params.openInline = params.cancelButton = params.refreshAction = false;
           ui.panel.on('crmFormLoad', function() {
             // Hack: "Save and done" and "Cancel" buttons submit without ajax
-            $('.cancel.crm-form-submit, input[name$=upload_done]', this).on('click', function(e) {
+            $('.cancel.crm-form-submit, button[name$=upload_done]', this).on('click', function(e) {
               $(this).closest('form').ajaxFormUnbind();
             });
           });
index 0b8f6645c1582466ab42b5ab0aed32f79a74afbd..10c9628b2dbd36daa610a2d3ccbeb3dad50e1489 100644 (file)
@@ -12,7 +12,7 @@
 {literal}
 <script type="text/javascript">
 CRM.$(function($) {
-  var more = $('.crm-button input.validate').click(function(e) {
+  var more = $('.crm-button.validate').click(function(e) {
     var message = "{/literal} {if $context eq 'Event'}
         {ts escape='js'}Note: Revenue for this event registration will not be deferred as the financial type does not have a deferred revenue account setup for it. If you want the revenue to be deferred, please select a different Financial Type with a Deferred Revenue account setup for it, or setup a Deferred Revenue account for this Financial Type.{/ts}
       {else if $context eq 'MembershipType'}