From 35b0c46eacc93ccaf2078cb6749708d2911057cb Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 14 Feb 2015 19:09:51 +0000 Subject: [PATCH] ArrayInput: add 'isEmpty' option --- source/UI/js/Form/ArrayInput.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/UI/js/Form/ArrayInput.js b/source/UI/js/Form/ArrayInput.js index 4a6e5752..4e4fb9b1 100644 --- a/source/UI/js/Form/ArrayInput.js +++ b/source/UI/js/Form/ArrayInput.js @@ -20,7 +20,10 @@ Ox.ArrayInput = function(options, self) { self = self || {}; var that = Ox.Element({}, self) .defaults({ - getInput: null, + getInput: Ox.Input, + isEmpty: function(value) { + return value === ''; + }, label: '', max: 0, setWidth: null, @@ -34,7 +37,6 @@ Ox.ArrayInput = function(options, self) { width: setWidths }); - self.options.getInput = self.options.getInput || Ox.Input; self.options.value = self.options.value || []; if (self.options.label) { @@ -138,7 +140,7 @@ Ox.ArrayInput = function(options, self) { return Ox.map(self.$input, function($input) { return $input.value(); }).filter(function(value) { - return value !== ''; + return !self.options.isEmpty(value); }); };