diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 3d05275de48..95572a5c443 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -21,6 +21,7 @@
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (C) 2018 Christophe Battarel
* Copyright (C) 2018 Josep Lluis Amador
+ * Copyright (C) 2023 Joachim Kueter
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -2503,6 +2504,7 @@ class Form
$error++;
dol_print_error($db);
}
+ $out .= '';
if (empty($nooutput)) {
print $out;
} else {