From 144a3ecb4f610879c12dd10c31a7e310755e4781 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 24 Nov 2015 20:18:57 -0500 Subject: update profile --- StoneIsland/www/js/vendor/view/serializable.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'StoneIsland/www/js/vendor/view') diff --git a/StoneIsland/www/js/vendor/view/serializable.js b/StoneIsland/www/js/vendor/view/serializable.js index a2ff1147..e9459229 100644 --- a/StoneIsland/www/js/vendor/view/serializable.js +++ b/StoneIsland/www/js/vendor/view/serializable.js @@ -5,13 +5,13 @@ var SerializableView = View.extend({ "focus input": "focus_input", }, - preload: function(){ - if (sdk.env == "production") { return } - - this.test_data['ConfirmEmail'] = this.test_data['Email'] - Object.keys(this.test_data).forEach(function(key){ + preload: function(data){ + if (! data && sdk.env == "production") { return } + data = data || this.test_data + if (! data) { return } - var value = this.test_data[key] + Object.keys(data).forEach(function(key){ + var value = data[key] var $el = this.$("[name=" + key + "]") if ($el.attr("type") == "checkbox") { @@ -30,7 +30,14 @@ var SerializableView = View.extend({ serialize: function(){ var fields = {} this.$("input[name], select[name], textarea[name]").each( function(){ - fields[this.name] = this.value + if (this.type == "checkbox") { + if ($(this).prop("checked")) { + fields[this.name] = this.value + } + } + else { + fields[this.name] = this.value + } }) return fields }, -- cgit v1.2.3-70-g09d2