CRM-17886 - Fix contribution page toggleSubmitButton js
authorColeman Watts <coleman@civicrm.org>
Wed, 27 Jan 2016 21:20:23 +0000 (16:20 -0500)
committerColeman Watts <coleman@civicrm.org>
Wed, 27 Jan 2016 21:20:23 +0000 (16:20 -0500)
templates/CRM/Core/BillingBlock.tpl

index c46a2b36bde8ef4998879431c4ea242d889dc041..adc489308d35152fe9fdb2630278404898e524dd 100644 (file)
                 .replace(/-/g, '');
         $('#credit_card_number').val(cc);
       });
-    });
 
-    $('input[name="payment_processor_id"]').change( function() {
       function toggleConfirmButton() {
         var suppressSubmitButton = {/literal}"{$suppressSubmitButton}"{literal};
-        var elementObj = $('input[name="payment_processor"]');
-        if ( elementObj.attr('type') == 'hidden' ) {
-          var processorTypeId = elementObj.val( );
-        }
-        else {
-          var processorTypeId = elementObj.filter(':checked').val();
-        }
-
-        if (suppressSubmitButton) {
-          $("#crm-submit-buttons").hide();
-        }
-        else {
-          $("#crm-submit-buttons").show();
-        }
+        $("#crm-submit-buttons").toggle(!suppressSubmitButton);
       }
       toggleConfirmButton();
+      $('input[name="payment_processor_id"]').change(toggleConfirmButton);
     });
 
   </script>