diff --git a/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/barleyNetBlotchForm.json b/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/barleyNetBlotchForm.json index 0b84b056c8b5ba9ccf3f8e9d9095ffaea118c0f7..eafca7770e4014fb1dca56dbc7737e194991df89 100755 --- a/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/barleyNetBlotchForm.json +++ b/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/barleyNetBlotchForm.json @@ -18,6 +18,11 @@ ], "_comment" : "Structure of the barleyNetBlotchForm and how to validate it", "fields": [ + { + "name" : "weatherDataSourceType", + "dataType" : "STRING", + "required" : true + }, { "name" : "latitude", "dataType" : "DOUBLE", diff --git a/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html b/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html index 7e22cc8d3043956af359b747066608c835c79465..4305be96ffece7fc8b4c471a1ed42cf87a592301 100755 --- a/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html +++ b/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html @@ -32,6 +32,7 @@ <link type="text/css" rel="stylesheet" href="https://logic.testvips.nibio.no/css/mapModal.css" /> <style> + /* Added when integrating map, should perhaps be moved to main css file. */ input#latitude, input#longitude { width: 30%; display: inline-block; @@ -76,7 +77,7 @@ <label class="main-label">Jeg vil bruke værdata</label> <div class="radio"> <label> - <input type="radio" name="weatherdataType" id="coordinates" value="coordinates" checked onchange="displayCoordinatesInput()"> + <input type="radio" name="weatherDataSourceType" id="grid" value="grid" checked onchange="displayCoordinatesInput()"> for et spesifikt punkt (koordinater) </label> <div id="input-coordinates"> @@ -88,7 +89,7 @@ </div> <div class="radio"> <label> - <input type="radio" name="weatherdataType" id="weatherstation" value="weatherstation" onchange="displayWeatherstationInput()"> + <input type="radio" name="weatherDataSourceType" id="weatherstation" value="weatherstation" onchange="displayWeatherstationInput()"> fra en værstasjon </label> <div id="input-weatherstation" style="display: none;"> @@ -298,8 +299,8 @@ window.validateFormExtra = () => { var theForm = document.getElementById("{{ form_id }}"); // Location: Either weatherStationId or latitude/longitude must be set - const selectedWeatherdataType = theForm.querySelector('input[name="weatherdataType"]:checked').value; - if( selectedWeatherdataType === "coordinates") { + const selectedWeatherdataType = theForm.querySelector('input[name="weatherDataSourceType"]:checked').value; + if( selectedWeatherdataType === "grid") { const trimmedLat = theForm["latitude"].value.trim() const trimmedLon = theForm["longitude"].value.trim() if(trimmedLat === "" || trimmedLon === "" || isNaN(Number(trimmedLat)) || isNaN(Number(trimmedLon))) {