I'm very new to any kind of coding so please bear with me.
I have a layer on GeoServer that I can apply a specific CQL filter to as shown below:
var wmsLayer = L.Geoserver.wms("http://localhost:8080/geoserver/wms", {
layers: "MB:MB_Property_Assessment",
format: 'image/png',
transparent: true,
CQL_FILTER: "Dwelling_U='4'",
version: '1.1.0',
});
However I'd like to take a user input and apply the value to the filter to have the map update with the results rather than just the hardcoded value I currently have in there.
This is what I currently have in the body for taking the user input:
Enter the number of dwelling units
<input type="text" placeholder="Type " id="inputId">
<button type="button" onclick="getInputValue();">Get Value</button>
<script>
function getInputValue() {
// Selecting the input element and get its value
let inputVal = document.getElementById("inputId").value;
}
</script>
wmsLayer.setParams({ CQL_FILTER: "something" + inputVal })
.