oxjs/source/js/Ox.FormItem.js
2011-04-23 00:03:10 +02:00

27 lines
647 B
JavaScript

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;
}