From c0816b262c63dc3dab15d7ae7001bceb23f67e78 Mon Sep 17 00:00:00 2001 From: Eric Duminil <eric.duminil@gmail.com> Date: Tue, 4 Oct 2022 16:49:38 +0200 Subject: [PATCH] Checking checkboxes --- .../website/script/simstadt_openlayers.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 cf4aad5..c16fd46 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,7 +364,17 @@ var regionChooser = (function(){ publicScope.clickety_click = function() { console.log("You clicked pretty well"); - document.querySelectorAll("input.select_citygml").forEach(x => console.log(x)); + var checkboxes = document.querySelectorAll("input.select_citygml"); + if (checkboxes.length === 0){ + //FIXME: Wrong. There are at least one checkbox. + 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) + } + }); + } } focusOnMap(); -- GitLab