in form element group, don't throw if an element doesn't have a value method (which allows for adding buttons, for example)

This commit is contained in:
rolux 2013-03-01 10:43:52 +05:30
parent 82aeddccfe
commit ceac7fa942

View file

@ -79,7 +79,7 @@ Ox.FormElementGroup = function(options, self) {
function getValue() {
var value = self.options.elements.map(function($element) {
return $element.value();
return $element.value ? $element.value() : void 0;
});
return self.options.join ? self.options.join(value) : value;
}
@ -93,7 +93,7 @@ Ox.FormElementGroup = function(options, self) {
? self.options.split(self.options.value)
: self.options.value;
values.forEach(function(value, i) {
self.options.elements[i].value(value);
self.options.elements[i].value && self.options.elements[i].value(value);
});
}
@ -116,7 +116,7 @@ Ox.FormElementGroup = function(options, self) {
@*/
that.value = function() {
var values = self.options.elements.map(function(element) {
return element.value();
return element.value ? element.value() : void 0;
});
return self.options.joinValues
? self.options.joinValues(values)