From 92513c46d44a21566c97f6cf2650dc69cb308375 Mon Sep 17 00:00:00 2001
From: Andrea Zagli <azagli@libero.it>
Date: Sat, 27 Jan 2024 08:49:08 +0100
Subject: [PATCH] Validator: no duplicated messages.

---
 src/fields.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/fields.rs b/src/fields.rs
index d2d396c..d304691 100644
--- a/src/fields.rs
+++ b/src/fields.rs
@@ -94,7 +94,11 @@ fn validate_std(f: &Field) -> String {
 				first = false;
 			}
 
-			s.push_str(format!("<li>{}</li>\n", &msg).as_str());
+			/* check if the message already exists */
+			let html = format!("<li>{}</li>\n", &msg);
+			if s.find(&html).is_none() {
+				s.push_str(&html);
+			}
 		}
 	}
 
-- 
2.49.0