From 096b1d33016a648fbec106ebb0390d58a17f0e4b Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 12 Jul 2021 18:59:47 +0200 Subject: [PATCH] LSform: display fields errors in same order as triggered --- src/includes/js/LSform.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/includes/js/LSform.js b/src/includes/js/LSform.js index 19b84f3a..d969f45a 100644 --- a/src/includes/js/LSform.js +++ b/src/includes/js/LSform.js @@ -388,13 +388,16 @@ var LSform = new Class({ if ($type(ul)) { if ($type(errors) != 'array') errors = new Array(errors); + var ctx = new Object(); + ctx.injectAfter = ul.getParent(); errors.each(function(txt){ var dd = new Element('dd'); dd.addClass('LSform'); dd.addClass('LSform-errors'); dd.set('html',txt); - dd.injectAfter(this.getParent()); - },ul); + dd.injectAfter(this.injectAfter); + this.injectAfter = dd; + }, ctx); var dt = ul.getParent('dd.LSform').getPrevious('dt'); if ($type(dt)) {