Ox.FormItem = function(options, self) { var self = self || {}, that = new Ox.Element('div', self) .defaults({ element: null, error: '', }) .options(options || {}) .addClass('OxFormItem') .append(self.options.element); self.$message = new Ox.Element() .addClass('OxFormMessage') .appendTo(that); that.setMessage = function(message) { self.$message.html(message)[message !== '' ? 'show' : 'hide'](); } that.value = function() { return self.options.element.value(); }; return that; }