From dde8d2f9dcf12150a451ef54c5a224729cb6752a Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Thu, 6 Aug 2020 16:06:56 -0400 Subject: [PATCH] Fix JS for input buttons that are now button buttons --- js/Common.js | 4 ++-- js/crm.ajax.js | 4 ++-- js/crm.searchForm.js | 2 +- templates/CRM/Contact/Form/Search/Builder.js | 2 +- templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl | 5 ++--- templates/CRM/Event/Form/ManageEvent/Registration.tpl | 2 +- templates/CRM/Mailing/Page/Event.tpl | 2 +- templates/CRM/Report/Form/Layout/Graph.tpl | 1 + templates/CRM/common/TabHeader.js | 2 +- templates/CRM/common/deferredFinancialType.tpl | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/js/Common.js b/js/Common.js index 2474b11b56..056c11cfe0 100644 --- a/js/Common.js +++ b/js/Common.js @@ -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; }); }) diff --git a/js/crm.ajax.js b/js/crm.ajax.js index e65bd7b2a2..757ebef063 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -498,7 +498,7 @@ 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'); @@ -522,7 +522,7 @@ $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 diff --git a/js/crm.searchForm.js b/js/crm.searchForm.js index 42a371dcec..c84d0f5ec2 100644 --- a/js/crm.searchForm.js +++ b/js/crm.searchForm.js @@ -134,7 +134,7 @@ // 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. diff --git a/templates/CRM/Contact/Form/Search/Builder.js b/templates/CRM/Contact/Form/Search/Builder.js index fd6a984c13..4dc3523571 100644 --- a/templates/CRM/Contact/Form/Search/Builder.js +++ b/templates/CRM/Contact/Form/Search/Builder.js @@ -293,7 +293,7 @@ }) // 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(); diff --git a/templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl b/templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl index 6ca766cc26..5a3bd09863 100644 --- a/templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl +++ b/templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl @@ -62,7 +62,7 @@
{$row.name}
{ts 1=$row.min_contribution|crmMoney}You must contribute at least %1 to get this item{/ts}
- +
{$row.description} @@ -235,7 +235,7 @@ 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) { @@ -347,4 +347,3 @@ {/literal} {/if} {/if} - diff --git a/templates/CRM/Event/Form/ManageEvent/Registration.tpl b/templates/CRM/Event/Form/ManageEvent/Registration.tpl index 4858e98032..27c4cdb59b 100644 --- a/templates/CRM/Event/Form/ManageEvent/Registration.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Registration.tpl @@ -396,7 +396,7 @@ invert = 0