fix a bug regarding the value of empty array inputs
This commit is contained in:
parent
8b589283f6
commit
923ed92bd7
1 changed files with 6 additions and 9 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue