From 0b350d344dbad02f2f53fbb3115f072371add90d Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 30 Apr 2024 21:21:01 +0200 Subject: [PATCH] don't use default distance of 11; don't overwrite distance if already entered --- frontend/main.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/main.ts b/frontend/main.ts index 15360e6..88bbd54 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -189,11 +189,6 @@ function selectBoatChange() { inputElement.value = formattedDateTime; - const distinput = ( - document.querySelector("#distance_in_km") - ); - distinput.value = ""; - const destinput = ( document.querySelector("#destination") ); @@ -759,9 +754,11 @@ function addRelationMagic(bodyElement: HTMLElement) { }, ); + if (option && option.value !== ""){ // Get distance const distance = option.getAttribute("distance"); - if (distance) relatedField.value = distance; + if (distance && relatedField.value === "") relatedField.value = distance; + } } }); } -- 2.45.2