From c9085852a8ba73398aa550ebd5d2745cdff07daf Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:58:13 +0200 Subject: [PATCH] [QSO edit] Check grid length to stop distance/bearing call when grid is removed --- assets/js/sections/common.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index c2385bef..ceb493e5 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -139,10 +139,12 @@ function qso_edit(id) { }); $('#locator').change(function(){ - $('#locator_info').load("logbook/searchbearing/" + $(this).val() + "/" + $('#stationProfile').val()).fadeIn("slow"); - $.get('logbook/searchdistance/' + $(this).val() + "/" + $('#stationProfile').val(), function(result) { - document.getElementById("distance").value = result; - }); + if ($(this).val().length >= 4) { + $('#locator_info').load("logbook/searchbearing/" + $(this).val() + "/" + $('#stationProfile').val()).fadeIn("slow"); + $.get('logbook/searchdistance/' + $(this).val() + "/" + $('#stationProfile').val(), function(result) { + document.getElementById("distance").value = result; + }); + } }); $('#sota_ref_edit').selectize({