LSform : Added display of errors of elements not displayed on the LSform warnBox
authorBenjamin Renard <brenard@easter-eggs.com>
Wed, 17 Nov 2010 14:52:37 +0000 (15:52 +0100)
committerBenjamin Renard <brenard@easter-eggs.com>
Wed, 17 Nov 2010 14:52:37 +0000 (15:52 +0100)
public_html/includes/js/LSform.js

index 6f48f3c..a25edfe 100644 (file)
@@ -27,14 +27,15 @@ var LSform = new Class({
           this.params={};
         }
         this._ajaxSubmit=this.params.ajaxSubmit;
+
+        this.warnBox = new LSinfosBox({
+          name: 'LSformWarnBox',
+          fxDuration: 600,
+          closeBtn: 1,
+          autoClose: 0
+        });
+
         if ($type(this.params.warnings)) {
-          this.warnBox = new LSinfosBox({
-            name: 'LSformWarnBox',
-            fxDuration: 600,
-            closeBtn: 1,
-            autoClose: 0
-          });
-          
           this.warnTxt = '<ul>';
           this.params.warnings.each(function(w) {
             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() {