LSform: fix displaying error in form in case of global error

This commit is contained in:
Benjamin Renard 2021-01-18 15:04:14 +01:00
parent 957777d44f
commit 9680f8a18e

View file

@ -359,12 +359,14 @@ var LSform = new Class({
this.submitting = false; this.submitting = false;
this.LSform.removeClass('submitting'); this.LSform.removeClass('submitting');
var data = JSON.decode(responseText); var data = JSON.decode(responseText);
if ( varLSdefault.checkAjaxReturn(data) ) { // Handle common Ajax return checks
this.resetErrors(); varLSdefault.checkAjaxReturn(data);
if ($type(data.LSformErrors) == 'object') {
data.LSformErrors = new Hash(data.LSformErrors); // Handle LSform errors
data.LSformErrors.each(this.addError,this); this.resetErrors();
} if (data && $type(data.LSformErrors) == 'object') {
data.LSformErrors = new Hash(data.LSformErrors);
data.LSformErrors.each(this.addError, this);
} }
}, },