// vim: et:ts=4:sw=4:sts=4:ft=js /*@ Ox.FormItem FormItem Element, wrap form element with an error message () -> FormItem Element (options) -> FormItem Element (options, self) -> FormItem Element options Options object element element error error message self Shared private variable @*/ Ox.FormItem = function(options, self) { self = self || {}; var that = Ox.Element({}, self) .defaults({ element: null, error: '', }) .options(options || {}) .addClass('OxFormItem') .append(self.options.element); self.$message = Ox.Element() .addClass('OxFormMessage') .appendTo(that); /*@ setMessage set message (message) -> set message @*/ that.setMessage = function(message) { self.$message.html(message)[message !== '' ? 'show' : 'hide'](); }; /*@ value get value () -> get value of wrapped element @*/ that.value = function() { return self.options.element.value(); }; return that; };