From b74173c0ed6086b71123f5d76ab2657d4916c174 Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Tue, 4 Oct 2022 21:37:15 +0200
Subject: [PATCH] Check checked inputs

---
 .../website/script/simstadt_openlayers.js             | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js b/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
index c16fd46..99fbfba 100644
--- a/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
+++ b/src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
@@ -364,15 +364,12 @@ var regionChooser = (function(){
 	
 	publicScope.clickety_click = function() {
 		console.log("You clicked pretty well");
-		var checkboxes = document.querySelectorAll("input.select_citygml");
-		if (checkboxes.length === 0){
-			//FIXME: Wrong. There are at least one checkbox.
+		var checkedBoxes = Array.from(document.querySelectorAll("input.select_citygml")).filter(x => x.checked);
+		if (checkedBoxes.length === 0){
 			console.log("You should select at least one citygml, though.");
 		} else{
-			checkboxes.forEach(x => {
-				if (x.checked){
-					console.log("Nice! You checked Citygml " + x.id)
-				}
+			checkedBoxes.forEach(x => {
+				console.log("Nice! You checked Citygml " + x.id)
 			});
 		}
 	}
-- 
GitLab