From 1a10894e886c957cdeb483609de7adb26c8c0663 Mon Sep 17 00:00:00 2001 From: pascal Date: Sat, 30 Sep 2023 17:51:14 +0200 Subject: [PATCH 1/2] FIX #25127 --- htdocs/core/lib/functions.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 19862b2b4f2..a7554ed27e6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9999,6 +9999,8 @@ function printCommonFooter($zone = 'private') // Add 'field required' class on closest td for all input elements : input, textarea and select print 'jQuery(":input[name=\'' . $paramkey . '\']").closest("tr").find("td:first").addClass("fieldrequired");' . "\n"; } + // If we submit the cancel button we remove the required attributes + print 'jQuery("input[name=\'cancel\']").click(function() {jQuery("input, textarea, select").each(function(){this.removeAttribute(\'required\');});});'."\n"; } } } From c6803b5c1092cf839498250f367246c4a049b0c8 Mon Sep 17 00:00:00 2001 From: pascal Date: Mon, 2 Oct 2023 11:08:55 +0200 Subject: [PATCH 2/2] Add console log message --- htdocs/core/lib/functions.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a7554ed27e6..df24dffba8d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10000,7 +10000,10 @@ function printCommonFooter($zone = 'private') print 'jQuery(":input[name=\'' . $paramkey . '\']").closest("tr").find("td:first").addClass("fieldrequired");' . "\n"; } // If we submit the cancel button we remove the required attributes - print 'jQuery("input[name=\'cancel\']").click(function() {jQuery("input, textarea, select").each(function(){this.removeAttribute(\'required\');});});'."\n"; + print 'jQuery("input[name=\'cancel\']").click(function() { + console.log("We click on cancel button so removed all required attribute"); + jQuery("input, textarea, select").each(function(){this.removeAttribute(\'required\');}); + });'."\n"; } } }