From a9fdf2153d0c5c32c9ef475bd97a41ff7d38ad86 Mon Sep 17 00:00:00 2001 From: Meisenburger13 Date: Thu, 31 Aug 2023 22:19:52 -0400 Subject: [PATCH] prevent empty search --- templates/includes/header.html | 3 ++- templates/index.html | 13 +++++++++++-- templates/results.html | 8 ++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/templates/includes/header.html b/templates/includes/header.html index 79984b3..3993f6e 100644 --- a/templates/includes/header.html +++ b/templates/includes/header.html @@ -10,7 +10,7 @@
{% if search_term %} -
+
diff --git a/templates/index.html b/templates/index.html index b23e0ea..699ab96 100644 --- a/templates/index.html +++ b/templates/index.html @@ -12,7 +12,7 @@
-
+

Welcome to NFDI4DS Gateway

@@ -32,9 +32,10 @@

The vision of NFDI4DS is to support all +

-
+
Search Tips: Ricardo Usbeck @@ -236,6 +237,14 @@

Partners

{% endblock javascripts %} \ No newline at end of file diff --git a/templates/results.html b/templates/results.html index fe4d295..3257faf 100644 --- a/templates/results.html +++ b/templates/results.html @@ -205,6 +205,14 @@ }); + function emptySearch() { + var search = document.forms["searchbox"]["txtSearchTerm"].value; + if (search == "" || search == null || !/\S/.test(search)) { + document.getElementById("emptySearch").innerHTML = "\u2B11" + "Please enter a search term"; + return false; + } + } +