From 9de008f59083219055b98cd30504de8c7e758511 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 18 Dec 2017 10:51:31 -0500 Subject: [PATCH] Settup up the custom field so they get updated. When updating the registrant or attendee it will save the custom fields. --- js/frontRegApp.js | 11 ++++++++++- js/views/front/regRequestRegistrant.js | 8 +++++++- js/views/front/regTime.js | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/js/frontRegApp.js b/js/frontRegApp.js index af33b67..02e6429 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -819,6 +819,11 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ // update the model update: function(){ + // Need to grab all of the custom field data and serialize it here first. + // For some reason this is not available after the newRegistrant is added + // to the collection. + var customFieldData = this.$( 'form.attendee-cf-form-' + this.model.get('id') ).serialize(); + var modelId = this.model.get( 'id' ); var fname = this.$('.reg_fname').val().trim(); var lname = this.$('.reg_lname').val().trim(); @@ -855,7 +860,8 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ state: state, zip: zip, country: country, - reg_time: rTime + reg_time: rTime, + customFields: customFieldData, }); this.model.save(); if ( this.model.validationError ) { @@ -1012,6 +1018,9 @@ app.Views.Front.RegTime = Backbone.View.extend({ return; } + // Need to grab all of the custom field data and serialize it here first. + // For some reason this is not available after the newRegistrant is added + // to the collection. var customFieldData = this.$( 'form.attendee-cf-form-new' ).serialize(); // return false; diff --git a/js/views/front/regRequestRegistrant.js b/js/views/front/regRequestRegistrant.js index 783e4fe..fc3b185 100644 --- a/js/views/front/regRequestRegistrant.js +++ b/js/views/front/regRequestRegistrant.js @@ -21,6 +21,11 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ // update the model update: function(){ + // Need to grab all of the custom field data and serialize it here first. + // For some reason this is not available after the newRegistrant is added + // to the collection. + var customFieldData = this.$( 'form.attendee-cf-form-' + this.model.get('id') ).serialize(); + var modelId = this.model.get( 'id' ); var fname = this.$('.reg_fname').val().trim(); var lname = this.$('.reg_lname').val().trim(); @@ -57,7 +62,8 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ state: state, zip: zip, country: country, - reg_time: rTime + reg_time: rTime, + customFields: customFieldData, }); this.model.save(); if ( this.model.validationError ) { diff --git a/js/views/front/regTime.js b/js/views/front/regTime.js index 084449e..9af23a5 100644 --- a/js/views/front/regTime.js +++ b/js/views/front/regTime.js @@ -101,6 +101,9 @@ app.Views.Front.RegTime = Backbone.View.extend({ return; } + // Need to grab all of the custom field data and serialize it here first. + // For some reason this is not available after the newRegistrant is added + // to the collection. var customFieldData = this.$( 'form.attendee-cf-form-new' ).serialize(); // return false; -- 2.17.1