diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-11-24 20:18:57 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-11-24 20:18:57 -0500 |
| commit | 144a3ecb4f610879c12dd10c31a7e310755e4781 (patch) | |
| tree | e6b8566d06d138c20b9b3a6af06afe19da4c6e2d /StoneIsland/www/js/vendor/view | |
| parent | 5feeefffa62b131baff63e3241441727cf956fb6 (diff) | |
update profile
Diffstat (limited to 'StoneIsland/www/js/vendor/view')
| -rw-r--r-- | StoneIsland/www/js/vendor/view/serializable.js | 21 |
1 files changed, 14 insertions, 7 deletions
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 }, |
