summaryrefslogtreecommitdiffstats
path: root/public_html
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-03-22 14:32:08 +0100
committerAleksander Machniak <alec@alec.pl>2012-03-22 14:32:08 +0100
commitf67428d5163af64c92ad8c01a8ef9ce1e1040a4b (patch)
tree4cf5f918a8bbe20cffd4e4e4930b36e2293f0e1a /public_html
parentc4230788ffd11c709097129ddbcfa24b8d94ddef (diff)
downloadwebadmin-f67428d5163af64c92ad8c01a8ef9ce1e1040a4b.tar.gz
Support multiselect fields with fix for form serialization
Diffstat (limited to 'public_html')
-rw-r--r--public_html/js/kolab_admin.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index ad2f6bc..dabf56c 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -906,16 +906,17 @@ function kolab_admin()
if (v = $('[name="'+extra[i]+'"]', form).val())
json[extra[i]] = v;
- this.form_serialize({id: id, json: json});
-/*
- // convert values of list elements to array type
- $('textarea[data-type="list"]', form).each(function() {
+ // serializeArray() doesn't work properly for multi-select
+ $('select[multiple="multiple"]', form).each(function() {
var name = this.name;
- // maybe already converted by skin engine
- if (!json[name] || !$.isArray(json[name]))
- json[name] = $(this).val().split("\n");
+ json[name] = [];
+ $(':selected', this).each(function() {
+ json[name].push(this.value);
+ });
});
-*/
+
+ this.form_serialize({id: id, json: json});
+
return json;
};