LSform : fixed JS bug leaving previous errors messages in form in case of multiple...
authorBenjamin Renard <brenard@easter-eggs.com>
Thu, 19 Jun 2014 15:09:57 +0000 (17:09 +0200)
committerBenjamin Renard <brenard@easter-eggs.com>
Thu, 19 Jun 2014 15:10:13 +0000 (17:10 +0200)
public_html/includes/js/LSform.js

index 21d8464..a96d999 100644 (file)
@@ -224,8 +224,6 @@ var LSform = new Class({
         });
         this.LSformAjaxInput.injectInside(this.LSform);
         
-        this.resetErrors();
-        
         this.LSform.set('send',{
           data:         this.LSform,
           onSuccess:    this.onAjaxSubmitComplete.bind(this),
@@ -252,6 +250,7 @@ var LSform = new Class({
     onAjaxSubmitComplete: function(responseText, responseXML) {
       var data = JSON.decode(responseText);
       if ( varLSdefault.checkAjaxReturn(data) ) {
+        this.resetErrors();
         if ($type(data.LSformErrors) == 'object') {
           data.LSformErrors = new Hash(data.LSformErrors);
           data.LSformErrors.each(this.addError,this);