summaryrefslogtreecommitdiff
path: root/public_html/js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-03-15 12:53:15 (GMT)
committerAleksander Machniak <alec@alec.pl>2012-03-15 12:53:15 (GMT)
commitef127300c69f7b701011a513b3712f2ca1b12641 (patch)
tree881f50046b416a33b67d3f4b0b9ba34cb1cb4186 /public_html/js
parente850aeb57db53fb2e70412f79ac57507715cc849 (diff)
downloadkolab-wap-ef127300c69f7b701011a513b3712f2ca1b12641.tar.gz
Fix list widget
Diffstat (limited to 'public_html/js')
-rw-r--r--public_html/js/kolab_admin.js27
1 files changed, 21 insertions, 6 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 08b6f31..26f1c10 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -412,6 +412,10 @@ function kolab_admin()
}
};
+ /*********************************************************/
+ /********* Forms *********/
+ /*********************************************************/
+
this.serialize_form = function(id)
{
var i, v, json = {},
@@ -429,13 +433,17 @@ function kolab_admin()
this.trigger_event('form-serialize', {id: id, json: json});
+ // convert values of list elements to array type
+ $('textarea[data-type="list"]', 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");
+ });
+
return json;
};
- /*********************************************************/
- /********* Forms *********/
- /*********************************************************/
-
this.form_value_change = function(events)
{
var i, j, e, elem, name, elem_name,
@@ -466,11 +474,18 @@ function kolab_admin()
this.form_value_response = function(response)
{
+ var i, val;
if (!this.api_response(response))
return;
- for (var i in response.result)
- $('[name="'+i+'"]').val(response.result[i]);
+ for (i in response.result) {
+ val = response.result[i];
+ if ($.isArray(val))
+ val = val.join("\n");
+ $('[name="'+i+'"]').val(val);
+
+ this.trigger_event('form-element-update', {name: i});
+ }
};
this.form_value_error = function(name)