/* A div displayting info. Div height= 1rem; MARKUP
*/ $.fn.uaDiv = function(options) { options = $.extend({ bMandatory: true, //true, TYPE_OPTIONAL, TYPE_IGNORE bToolTip: true, hint: '', msg: '' },options); options.bReadOnly = true; options.defaultValue = ''; $.fn.extend(this,this.uaBaseObject(options)); this. off(EV_CHECK_GENERIC_ERRORS). on(EV_INIT,function(ev) { ev.stopImmediatePropagation(); $(this).trigger(EV_SET_DEFAULT); }). on(EV_CLEAR,function(ev) { ev.stopImmediatePropagation(); $(this).html(''); }). on(EV_SET_DEFAULT,function(ev) { ev.stopImmediatePropagation(); switch(options.defaultValue.length) { case 0: $(this).html(""+options.hint+""); break; default: $(this).html(options.defaultValue); break; }; $(this).trigger($.Event(EV_SHOW,{uaData:{data:{bEnable:options.bEnabled}}})); }). on(EV_CLEAR_ERRORS,function(ev) { ev.stopImmediatePropagation(); $(this).removeClass('border rounded shadow border-danger'); }). on(EV_SET,function(ev) { ev.stopImmediatePropagation(); $(this).html(ev.uaData.data); }). on(EV_CHECK_GENERIC_ERRORS,function(ev) { ev.stopImmediatePropagation(); $(this).trigger(EV_CLEAR_ERRORS); $(this).addClass('border rounded shadow border-danger') if(!options.bMandatory) return; { $(this).trigger($.Event(EV_SET_ERROR_MSG,{uaData:{data:{msg:options.msg}}})); return; }; }). on(EV_CHECK_SPECIFIC_ERRORS,function(ev) {//no need ev.stopImmediatePropagation(); }). on(EV_ENABLE,function(ev) { ev.stopImmediatePropagation(); switch(ev.uaData.data.bEnable) { case true: $(this).removeClass('uaDisabled'); break; default: $(this).addClass('uaDisabled'); break; }; }); $(this).trigger(EV_INIT); return this; };