From 3ed71d9bcf3f2e709ae29751d048babcac10bf8b Mon Sep 17 00:00:00 2001 From: Lene Wasskog <lene.wasskog@nibio.no> Date: Tue, 29 Oct 2024 08:14:23 +0100 Subject: [PATCH] fix: Validation of the radio buttons for weather data source type --- .../formdefinitions/barleyNetBlotchForm.json | 5 ----- .../templates/cerealblotchmodels/barleynetblotchform.html | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/barleyNetBlotchForm.json b/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/barleyNetBlotchForm.json index eafca777..0b84b056 100755 --- a/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/barleyNetBlotchForm.json +++ b/cerealblotchmodels/static/cerealblotchmodels/formdefinitions/barleyNetBlotchForm.json @@ -18,11 +18,6 @@ ], "_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 1ae14c15..3920553d 100755 --- a/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html +++ b/cerealblotchmodels/templates/cerealblotchmodels/barleynetblotchform.html @@ -305,11 +305,12 @@ alert("Mangler gyldig punkt"); return false; } - } - if (selectedWeatherdataType === "weatherstation") { + } else if (selectedWeatherdataType === "weatherstation") { if(theForm["weatherStationId"].options[theForm["weatherStationId"].selectedIndex].value == "-1") { alert("Mangler værstasjon") } + } else { + alert("Mangler type værdatakilde") } // Observation: Either no fields or all fields must be set -- GitLab