oxjs/source/Ox.UI/js/Form/Ox.FormItem.js
2011-04-29 14:40:51 +02:00

28 lines
677 B
JavaScript

// vim: et:ts=4:sw=4:sts=4:ft=js
Ox.FormItem = function(options, self) {
var self = self || {},
that = new Ox.Element({}, 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;
}