LSform : Added display of errors of elements not displayed on the LSform warnBox

This commit is contained in:
Benjamin Renard 2010-11-17 15:52:37 +01:00
parent 30d9fd00c3
commit b1f3f3a16f

View file

@ -27,14 +27,15 @@ var LSform = new Class({
this.params={}; this.params={};
} }
this._ajaxSubmit=this.params.ajaxSubmit; this._ajaxSubmit=this.params.ajaxSubmit;
this.warnBox = new LSinfosBox({
name: 'LSformWarnBox',
fxDuration: 600,
closeBtn: 1,
autoClose: 0
});
if ($type(this.params.warnings)) { if ($type(this.params.warnings)) {
this.warnBox = new LSinfosBox({
name: 'LSformWarnBox',
fxDuration: 600,
closeBtn: 1,
autoClose: 0
});
this.warnTxt = '<ul>'; this.warnTxt = '<ul>';
this.params.warnings.each(function(w) { this.params.warnings.each(function(w) {
this.warnTxt +='<li>'+w+'</li>'; this.warnTxt +='<li>'+w+'</li>';
@ -272,6 +273,15 @@ var LSform = new Class({
} }
} }
} }
else {
this.tmp=name+" :</br><ul>";
errors = new Array(errors);
errors.each(function(error){
this.tmp += "<li>"+error+"</li>";
},this);
this.tmp +="</ul>";
this.warnBox.display(this.tmp);
}
} }
}); });
window.addEvent(window.ie ? 'load' : 'domready', function() { window.addEvent(window.ie ? 'load' : 'domready', function() {