From 5d4b66ead7be8ea213c9bfeaf16c752959645491 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 15 Dec 2017 13:23:52 -0500 Subject: [PATCH] Add custom fields into edit form for attendee Also adding form tag around where the custom field will go. --- js/frontRegApp.js | 22 +++++++++++++++++++++ js/views/front/regRequestRegistrant.js | 22 +++++++++++++++++++++ views/front/registrations/registration.html | 5 +++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/js/frontRegApp.js b/js/frontRegApp.js index 80aa485..39ca6b7 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -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 diff --git a/js/views/front/regRequestRegistrant.js b/js/views/front/regRequestRegistrant.js index c1cb305..345a9ac 100644 --- a/js/views/front/regRequestRegistrant.js +++ b/js/views/front/regRequestRegistrant.js @@ -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 ); + }); + }, }); diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index 3ff3e10..7bc75d5 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -223,7 +223,7 @@ jQuery(document).ready(function($) {
Email Address
-
+
Address (show/hide)
@@ -286,6 +286,7 @@ jQuery(document).ready(function($) {
Email Address
+
Address (show/hide)
@@ -350,7 +351,7 @@ jQuery(document).ready(function($) { {$reg_bulletin} {/if} - +
-- 2.17.1