From 9680f8a18e628978204c6bd9d179a06568642c63 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 18 Jan 2021 15:04:14 +0100 Subject: [PATCH] LSform: fix displaying error in form in case of global error --- src/includes/js/LSform.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/includes/js/LSform.js b/src/includes/js/LSform.js index 21ea50a3..aad26c46 100644 --- a/src/includes/js/LSform.js +++ b/src/includes/js/LSform.js @@ -359,12 +359,14 @@ var LSform = new Class({ this.submitting = false; this.LSform.removeClass('submitting'); 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); - } + // Handle common Ajax return checks + varLSdefault.checkAjaxReturn(data); + + // Handle LSform errors + this.resetErrors(); + if (data && $type(data.LSformErrors) == 'object') { + data.LSformErrors = new Hash(data.LSformErrors); + data.LSformErrors.each(this.addError, this); } },