Add custom fields into edit form for attendee
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 15 Dec 2017 18:23:52 +0000 (13:23 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 15 Dec 2017 18:23:52 +0000 (13:23 -0500)
Also adding form tag around where the custom field will go.

js/frontRegApp.js
js/views/front/regRequestRegistrant.js
views/front/registrations/registration.html

index 80aa485..39ca6b7 100644 (file)
@@ -880,6 +880,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({
         this.$el.html( this.template( this.model.toJSON() ) );
         this.$emailInput = this.$('.editEmail');
         this.$('.reg-edit-form').hide();
+        this.setCustomFieldsForm();
         return this;
     },
 
@@ -895,6 +896,27 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({
         this.remove();
     },
 
+    setCustomFieldsForm: function(){
+        var formData = {
+            'action': 'glm_members_admin_ajax',
+            'glm_action': 'customFieldsFront',
+            'option': 'displayForm',
+            'fid': 'glm_reg_customfields_reg_event_attendee_' + this.model.get('reg_event'),
+            'recordId': '1',
+            'parentFormId': 'abc-123',
+            'formData': false
+        };
+        $.ajax({
+            type: 'POST',
+            url: ajaxUrl,
+            data: formData,
+            encode: true,
+            dataType: 'text'
+        })
+        .done( function( formHtml ) {
+            $('.attendee-cf').html( formHtml );
+        });
+    },
 });
 
 // js/views/front/regTime.js
index c1cb305..345a9ac 100644 (file)
@@ -93,6 +93,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({
         this.$el.html( this.template( this.model.toJSON() ) );
         this.$emailInput = this.$('.editEmail');
         this.$('.reg-edit-form').hide();
+        this.setCustomFieldsForm();
         return this;
     },
 
@@ -108,4 +109,25 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({
         this.remove();
     },
 
+    setCustomFieldsForm: function(){
+        var formData = {
+            'action': 'glm_members_admin_ajax',
+            'glm_action': 'customFieldsFront',
+            'option': 'displayForm',
+            'fid': 'glm_reg_customfields_reg_event_attendee_' + this.model.get('reg_event'),
+            'recordId': '1',
+            'parentFormId': 'abc-123',
+            'formData': false
+        };
+        $.ajax({
+            type: 'POST',
+            url: ajaxUrl,
+            data: formData,
+            encode: true,
+            dataType: 'text'
+        })
+        .done( function( formHtml ) {
+            $('.attendee-cf').html( formHtml );
+        });
+    },
 });
index 3ff3e10..7bc75d5 100644 (file)
@@ -223,7 +223,7 @@ jQuery(document).ready(function($) {
                     <div class="columns large-4 small-12">Email Address</div>
                     <div class="columns large-8 small-12"><input class="add_reg_email" value="<%- email %>"></div>
                 </div>
-                <div class="attendee-cf"></div>
+                <form class="attendee-cf-form"><div class="attendee-cf"></div></form>
                 <div>
                     <a class="show-hide-address">Address (show/hide)</a>
                 </div>
@@ -286,6 +286,7 @@ jQuery(document).ready(function($) {
                         <div class="columns large-4 small-12">Email Address</div>
                         <div class="columns large-8 small-12"><input class="reg_email" value="<%- email %>"></div>
                     </div>
+                    <form class="attendee-cf-form"><div class="attendee-cf"></div></form>
                     <div>
                         <a class="show-hide-address">Address (show/hide)</a>
                     </div>
@@ -350,7 +351,7 @@ jQuery(document).ready(function($) {
             {$reg_bulletin}
         </div>
     {/if}
-    
+
     <div class="row">
         <div id="regApp" class="columns small-12">
         </div>