From 55322cce67a66ce47efc2650cf1f4279f8af261e Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 1 Dec 2014 17:44:07 +0100 Subject: [PATCH] use [] as default value for ArrayInput --- static/js/entitiesDialog.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/static/js/entitiesDialog.js b/static/js/entitiesDialog.js index 046f70fc2..70a967d4e 100644 --- a/static/js/entitiesDialog.js +++ b/static/js/entitiesDialog.js @@ -289,7 +289,7 @@ pandora.ui.entitiesDialog = function(options) { }, function(result) { Ox.Request.clearCache('findEntities'); $list.reloadList(); - pandora.UI.set('entitiesSelection.' + type, data.ids); + pandora.UI.set('entitiesSelection.' + type, [result.data.id]); }); } @@ -344,7 +344,8 @@ pandora.ui.entitiesDialog = function(options) { var keys = Ox.getObjectById(pandora.site.entities, type).keys; $form.empty() keys.forEach(function(key, index) { - var $label = Ox.Label({ + var defaultValue = void 0, + $label = Ox.Label({ title: Ox._(key.title), width: 240 - Ox.SCROLLBAR_SIZE }) @@ -363,6 +364,7 @@ pandora.ui.entitiesDialog = function(options) { $input = Ox.Input(); } else if (key.type[0] === 'string') { $input = Ox.ArrayInput(); + defaultValue = []; } else if (key.type === 'text') { $input = Ox.Input({ height: 240 - Ox.SCROLLBAR_SIZE, @@ -371,7 +373,7 @@ pandora.ui.entitiesDialog = function(options) { } $input.options({ disabled: key.id == 'id', - value: result.data[key.id], + value: result.data[key.id] || defaultValue, width: 240 - Ox.SCROLLBAR_SIZE }) .css({margin: '4px'})