diff --git a/source/Ox.UI/js/Form/Ox.ArrayInput.js b/source/Ox.UI/js/Form/Ox.ArrayInput.js index 95e0e6cb..207d4648 100644 --- a/source/Ox.UI/js/Form/Ox.ArrayInput.js +++ b/source/Ox.UI/js/Form/Ox.ArrayInput.js @@ -17,10 +17,6 @@ Ox.ArrayInput = function(options, self) { }) .options(options || {}); - if (self.options.value.length == 0) { - self.options.value = ['']; - } - if (self.options.label) { self.$label = Ox.Label({ title: self.options.label, @@ -34,7 +30,9 @@ Ox.ArrayInput = function(options, self) { self.$removeButton = []; self.$addButton = []; - self.options.value.forEach(function(value, i) { + ( + self.options.value.length ? self.options.value : [''] + ).forEach(function(value, i) { addInput(i, value); }); @@ -126,13 +124,12 @@ Ox.ArrayInput = function(options, self) { } function setValue() { - if (self.options.value.length == 0) { - self.options.value = ['']; - } while (self.$input.length) { removeInput(0); } - self.options.value.forEach(function(value, i) { + ( + self.options.value.length ? self.options.value : [''] + ).forEach(function(value, i) { addInput(i, value); }); }