'use strict'; Ox.ObjectInput = function(options, self) { self = self || {}; var that = Ox.Element({}, self) .defaults({ elements: [], labelWidth: 128, width: 256 }) .options(options || {}) .addClass('OxObjectInput') .css({ width: self.options.width + 'px', height: self.options.elements.length * 24 - 8 + 'px' }); self.options.elements.forEach(function($element) { $element.options({ labelWidth: self.options.labelWidth, width: self.options.width }) .bindEvent({ change: function(data) { self.options.value = {}; self.options.elements.forEach(function(element) { self.options.value[element.options('id')] = element.value(); }); that.triggerEvent('change', { value: self.options.value }); } }) .appendTo(that); }); self.setOption = function(key, value) { if (key == 'value') { // ... } }; return that; };