aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/static/main.js8
-rw-r--r--src/templates/options.html2
2 files changed, 9 insertions, 1 deletions
diff --git a/src/static/main.js b/src/static/main.js
index 58052b7..9bdaa11 100644
--- a/src/static/main.js
+++ b/src/static/main.js
@@ -13,6 +13,12 @@ var heatmap = L.featureGroup().addTo(map);
const CategoryField = document.getElementById('Category');
const LoadingIndicator = document.getElementById('LoadingIndicator');
+const form = document.getElementById('QueryForm');
+
+form.addEventListener('submit', (event) => {
+ event.preventDefault(); // Prevents the default form submission
+ runQueryAfterLoad()
+});
const DefaultSearchValue = "supermarket";
var Categories = []
@@ -27,6 +33,8 @@ var layerControl = L.control.layers({},overlayMaps).addTo(map);
function runQueryAfterLoad() {
LoadingIndicator.hidden = false;
+ markers.clearLayers();
+ polygons.clearLayers();
fetchAll(CategoryField.value);
}
diff --git a/src/templates/options.html b/src/templates/options.html
index ca079e7..b607dca 100644
--- a/src/templates/options.html
+++ b/src/templates/options.html
@@ -1,5 +1,5 @@
<h1>POI map</h1>
-<form>
+<form id="QueryForm">
<label for="Category" class="form-label"><h3>Category</h3></label>
<input class="form-control" list="CategoriesDataList" id="Category" name="Category" placeholder="Type to search..."
aria-describedby="CategoriesHelp" value=""> {# Value set to empty string is important for JS function #}