summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/vendor/view/serializable.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/vendor/view/serializable.js')
-rw-r--r--StoneIsland/www/js/vendor/view/serializable.js21
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
},