--- /dev/null
+{include file='admin/registrations/eventHeader.html'}
+
+    <h1>
+        {$regEvent.event_name}
+
+           
+        {if $regEventUpdated}<span class="glm-notice glm-flash-updated">Registration Event Updated</span>{/if}
+        {if $regEventUpdateError}<span class="glm-error glm-flash-updated">Registration Event Update Error</span>{/if}
+        {if $regEventAdded}<span class="glm-notice glm-flash-updated">Registration Event Added</span>{/if}
+
+    </h1>
+
+<div class="glm-admin-table-inner glm-admin-table">
+
+{if $haveMessages}
+    <div class="glm-error" style="font-size: 1rem; line-height: 1rem; margin-top: 1rem;">
+        <i>Please Note:</i>
+        <UL>
+  {foreach $messages as $m}
+            <li>{$m}</li>
+  {/foreach}          
+        </UL>
+    </div>
+{/if}
+
+    <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+        <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard" class="nav-tab">Event Dashboard</a>
+        <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=edit®EventID={$regEventID}" class="nav-tab">Edit Registration Settings</a>
+        <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=configureEvent®EventID={$regEventID}" class="nav-tab">Registration Levels & Charges</a> 
+        <a onClick="return false;" class="nav-tab nav-tab-active">Additional Fields</a> 
+         
+    </h2>
+    
+    
+{if apply_filters('glm-members-customfields-active', false)}
+    <p><hr></p>
+
+    {* Per Event Form for this event *}
+    <h3>Per submission including this event</h3>
+    <p>These are additional fields of information that will be requested for this event in each submission.</p>
+    <p>
+        {assign var="eventFid" value="glm_reg_customfields_reg_event_`$regEventID`"}
+        {apply_filters('glm-members-customfields-edit', '', $eventFid)}
+    </p>
+
+    {* Per Attendee Form for this event *}
+    <p><hr></p>
+    <h3>Each attendee for this event</h3>
+    <p>These are additional fields of information that will be requested for each registrant for this event.</p>
+    <p> 
+        {assign var="attendeeFid" value="glm_reg_customfields_reg_attendee_`$regEventID`"}
+        {apply_filters('glm-members-customfields-edit', '', $attendeeFid)}
+    </p>
+
+    {* Per Attendee form for each class (level) for this event *}
+    <p><hr></p>
+  {foreach $classes as $class}
+    <h3>Each attendee for level: {$class.name}</h3>
+    <p>These are additional fields of information that will be requested for each registrant for this event.</p>
+    <p> 
+        {assign var="levelFid" value="glm_reg_customfields_reg_event_`$regEventID`_level_`$class.id`"}
+        {apply_filters('glm-members-customfields-edit', '', $levelFid)}
+    </p>
+    <p><hr></p>
+  {/foreach}
+
+{/if}
+   
+    
+    
+</div>
+
+{include file='admin/footer.html'}
+
 
 {include file='front/registrations/header.html'}
 
 {if $checkoutPageText}
-<div>
-    {$checkoutPageText}
-</div>
+    <div>
+        {$checkoutPageText}
+    </div>
 {/if}
 
 {if $haveMessages}
   {/if} {* / total charges > 0 *}
             </div>
     {if apply_filters('glm-members-customfields-active', false)}
-            <div class="glm-reg-row">
-                <div class="glm-small-12 glm-columns">
-                    <h4>Additional information we need to collect</h4>
       {foreach $cart.events as $event}
+        {assign var="fid" value="glm_reg_customfields_reg_event_`$event.reg_event`"} {* assemble the uid with the current event ID *}      
+        {if apply_filters('glm-members-customfields-have-fields', false, $fid)}
+            <div class="glm-reg-row">
+                <div class="glm-large-6 glm-small-12 glm-columns">
+                    <h4>Additional information for event: {$event.event_name}</h4>
                     <div class="glm-reg-row">
                         <div class="glm-large-12 glm-columns glm-reg-nowrap">
-                            <h5>{$event.event_name}:</h5>
-                             {apply_filters('glm-members-customfields-form-display', $eventCustomFieldsUid.{$event.id}, {$cart.id}, false)}
-                             
-                             GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG.'-customfields-reg-event-edit-'.$regEventID
-                             
+                {apply_filters('glm-members-customfields-form-display', '', $fid, $cartId, 'checkoutForm', false)}
                         </div>
                     </div>
-      {/foreach}
                 </div>
             </div>
+        {/if}
+      {/foreach}
     {/if}
             <div class="glm-reg-row">
                 <div class="glm-small-12 glm-columns">
                 <span class="glm-reg-warning">You have one more step to complete your registration!</span> <img src="{$assetUrl}/fingerRightRed.svg" style="height: 2em;"> <input id="regSubmitButton" type="submit" value="Submit Registration Request" class="button tiny">
             </div>
 
-
-        </form>
-
-        <div id="regSubmitDialog" title="Please wait...">Please wait while we process your registration request. If you don't see a new page, your registration request may not have been processed.</div>
-        <div id="regSubmitFailDialog" title="Oops!">
-            <h3>Something may have gone wrong.</h3>
-            <p>
-                It may be that your registration request was received and processed and you didn't receive our response yet.
-                If you still don't see a response in a while, try returning to the cart using the button above.
-                If still don't see any response, please check your E-Mail to see if you have been sent a confirmation.
-            </p>
-            <p>
-                In any case, we will never process your request more than once. If you can return to the cart, it should say if
-                your request was recieved and processed. If not, you may try the checkout process again or come back later.
-            </p>
         </div>
 
-        <h4 id="cart-summary">Registration Summary</h4>
-        <table class="glm-admin-table" width="100%">
+    </form>
+
+    <div id="regSubmitDialog" title="Please wait...">Please wait while we process your registration request. If you don't see a new page, your registration request may not have been processed.</div>
+    <div id="regSubmitFailDialog" title="Oops!">
+        <h3>Something may have gone wrong.</h3>
+        <p>
+            It may be that your registration request was received and processed and you didn't receive our response yet.
+            If you still don't see a response in a while, try returning to the cart using the button above.
+            If still don't see any response, please check your E-Mail to see if you have been sent a confirmation.
+        </p>
+        <p>
+            In any case, we will never process your request more than once. If you can return to the cart, it should say if
+            your request was recieved and processed. If not, you may try the checkout process again or come back later.
+        </p>
+    </div>
+
+    <h4 id="cart-summary">Registration Summary</h4>
+    <table class="glm-admin-table" width="100%">
 
-            <thead>
+        <thead>
 
-                <tr>
-                    <th>Registering</th>
-                    <th>Registrant</th>
-                    <th>Date/Time</th>
-                    <th>Discount</th>
-                    <th>Rate</th>
-                </tr>
+            <tr>
+                <th>Registering</th>
+                <th>Registrant</th>
+                <th>Date/Time</th>
+                <th>Discount</th>
+                <th>Rate</th>
+            </tr>
 
 
-            </thead>
+        </thead>
             <tbody>
   {foreach $cart.events as $event}
-                <tr>
-                    <th colspan="5">Event: {$event.event_name}</th>
-                </tr>
+            <tr>
+                <th colspan="5">Event: {$event.event_name}</th>
+            </tr>
     {foreach $event.classes as $class}
-                <tr>
-                    <td colspan="5">    {$class.class_name}</td>
-                </tr>
+            <tr>
+                <td colspan="5">    {$class.class_name}</td>
+            </tr>
       {foreach $class.rates as $rate}
         {if $rate.rateBaseCharge || $rate.registrant_credits}
-                <tr>
-                    <td colspan="4">
-                                {$rate.rate_name}
-                        - Base Rate ({$rate.registrant_credits} registrants included)
-                    </td>
-                    <td style="text-align: right;">
-                        {if $rate.rateBaseCharge}{$rate.rateBaseCharge|number_format:2}{/if}
-                    </td>
-                </tr>
+            <tr>
+                <td colspan="4">
+                            {$rate.rate_name}
+                    - Base Rate ({$rate.registrant_credits} registrants included)
+                </td>
+                <td style="text-align: right;">
+                    {if $rate.rateBaseCharge}{$rate.rateBaseCharge|number_format:2}{/if}
+                </td>
+            </tr>
         {/if}
         {foreach $rate.registrants as $registrant}
-                <tr>
-                    <td> </td>
-                    <td>{$registrant.fname} {$registrant.lname}</td>
-                    <td>{$registrant.timeReformatted}</td>
-                    <td style="text-align: right;">
-                        {if $registrant.registrantDiscounts > 0}
-                            {$registrant.registrantDiscounts|number_format:2}
-                        {else}
-                             
-                        {/if}
-                    </td>
-                    <td style="text-align: right;">
-                        {if $registrant.registrantRate > 0}
-                            {$registrant.registrantRate|number_format:2}
-                        {else}
-                            (included)
-                        {/if}
-                    </td>
-                </tr>
+            <tr>
+                <td> </td>
+                <td>{$registrant.fname} {$registrant.lname}</td>
+                <td>{$registrant.timeReformatted}</td>
+                <td style="text-align: right;">
+                    {if $registrant.registrantDiscounts > 0}
+                        {$registrant.registrantDiscounts|number_format:2}
+                    {else}
+                         
+                    {/if}
+                </td>
+                <td style="text-align: right;">
+                    {if $registrant.registrantRate > 0}
+                        {$registrant.registrantRate|number_format:2}
+                    {else}
+                        (included)
+                    {/if}
+                </td>
+            </tr>
           {assign var="acct" value=$cart.accounts.{$registrant.account}}
           {if $acct.validated.value}
-                <tr>
-                    <td colspan="2"> </td>
-                    <td colspan="3">
-                      {if $acct.email != ''}E-Mail: {$acct.email}<br>{/if}
-                      (Account information is restricted)
-                    </td>
-                </tr>
+            <tr>
+                <td colspan="2"> </td>
+                <td colspan="3">
+                  {if $acct.email != ''}E-Mail: {$acct.email}<br>{/if}
+                  (Account information is restricted)
+                </td>
+            </tr>
           {else}
             {if $acct.addr1 != '' || $acct.phone != '' || $acct.email != ''}
-                <tr>
-                    <td colspan="2"> </td>
-                    <td colspan="3">
-                      {if $acct.org != ''}          {$acct.title}, {$acct.org}<br>                      {/if}
-                      {if $acct.addr1 != ''}        {$acct.addr1}<br>                                   {/if}
-                      {if $acct.addr2 != ''}        {$acct.addr2}<br>                                   {/if}
-                      {if $acct.city != ''}         {$acct.city}, {$acct.state.value} {$acct.zip}<br>   {/if}
-                      {if $acct.country.name != ''} {$acct.country.name}<br>                            {/if}
-                      {if $acct.phone != ''}        Phone: {$acct.phone}<br>                            {/if}
-                      {if $acct.fax != ''}          Fax: {$acct.fax}<br>                                {/if}
-                      {if $acct.email != ''}        E-Mail: {$acct.email}                               {/if}
-                    </td>
-                </tr>
+            <tr>
+                <td colspan="2"> </td>
+                <td colspan="3">
+                  {if $acct.org != ''}          {$acct.title}, {$acct.org}<br>                      {/if}
+                  {if $acct.addr1 != ''}        {$acct.addr1}<br>                                   {/if}
+                  {if $acct.addr2 != ''}        {$acct.addr2}<br>                                   {/if}
+                  {if $acct.city != ''}         {$acct.city}, {$acct.state.value} {$acct.zip}<br>   {/if}
+                  {if $acct.country.name != ''} {$acct.country.name}<br>                            {/if}
+                  {if $acct.phone != ''}        Phone: {$acct.phone}<br>                            {/if}
+                  {if $acct.fax != ''}          Fax: {$acct.fax}<br>                                {/if}
+                  {if $acct.email != ''}        E-Mail: {$acct.email}                               {/if}
+                </td>
+            </tr>
             {/if}
           {/if}
         {/foreach}
       {/foreach}
     {/foreach}
   {/foreach}
-            </tbody>
-            <tfoot>
-                <td colspan="2"> </td>
-                <td>Total registrants: {$cart.totalRegistrants}</td>
-                <td style="text-align: right;">
-                    {if $cart.totalDiscounts > 0}
-                        ${$cart.totalDiscounts|number_format:2}
-                    {else}
-                         
-                    {/if}
-                </td>
-                <td style="text-align: right;">${$cart.totalCharges|number_format:2}</td>
-            </tfoot>
+        </tbody>
+        <tfoot>
+            <td colspan="2"> </td>
+            <td>Total registrants: {$cart.totalRegistrants}</td>
+            <td style="text-align: right;">
+                {if $cart.totalDiscounts > 0}
+                    ${$cart.totalDiscounts|number_format:2}
+                {else}
+                     
+                {/if}
+            </td>
+            <td style="text-align: right;">${$cart.totalCharges|number_format:2}</td>
+        </tfoot>
 {/if} {* / if have cart *}
-        </table>
-
-
-    </div>
-</div>
+    </table>
 
 <script type="text/javascript">
     jQuery(function($){
         });
 
         // Dissable checkout button when first clicked to prevent multiple attempts
-        $("#checkoutForm").submit(function(){
+        $("#checkoutForm").submit(function(e){
 
+            // If something else is preventing submission, stop here. Use this with custom fields when there are required fields.
+            if (e.isDefautPrevented()) {
+                return false;
+            }
+            
             // Show submit dialog box
             $( "#regSubmitDialog" ).dialog( "open" );