CRM-15483 - Fix js loading event form fee block
authorColeman Watts <coleman@civicrm.org>
Wed, 22 Oct 2014 18:39:00 +0000 (14:39 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 22 Oct 2014 18:39:00 +0000 (14:39 -0400)
templates/CRM/Event/Form/Participant.tpl

index 158cf9098582f8a89fd0306635038c5f28c7deff..109767ebc60a197839064f0ad491532dbdca5078 100644 (file)
          </table>
         {/if}
       {* Fee block (EventFees.tpl) is injected here when an event is selected. *}
-        <div id="feeBlock"></div>
+        <div class="crm-event-form-fee-block"></div>
         <fieldset>
           <table class="form-layout">
             <tr class="crm-participant-form-block-note">
           {/if}
 
           {literal}
-          var eventId = $('#event_id').val();
-
-          {/literal}{if $action eq 2}{literal}
-            if (typeof eventId == 'undefined') {
-              var eventId = $('[name=event_id]').val();
-            }
-          {/literal}{/if}{literal}
+          var eventId = $('[name=event_id], #event_id', $form).val();
 
           if (eventId) {
             dataUrl += '&eventId=' + eventId;
           }
           else {
-            $('#eventFullMsg').hide( );
-            $('#feeBlock').html('');
+            $('#eventFullMsg', $form).hide( );
+            $('.crm-event-form-fee-block', $form).html('');
             return;
           }
 
           $.ajax({
             url: dataUrl,
             success: function ( html ) {
-              $("#feeBlock").html( html ).trigger('crmLoad');
+              $(".crm-event-form-fee-block", $form).html( html ).trigger('crmLoad');
               //show event real full as well as waiting list message.
-              if ( $("#hidden_eventFullMsg").val( ) ) {
-                $( "#eventFullMsg" ).show( ).html( $("#hidden_eventFullMsg" ).val( ) );
+              if ( $("#hidden_eventFullMsg", $form).val( ) ) {
+                $( "#eventFullMsg", $form).show( ).html( $("#hidden_eventFullMsg", $form).val( ) );
               }
               else {
-                $( "#eventFullMsg" ).hide( );
+                $( "#eventFullMsg", $form ).hide( );
               }
             }
           });