fix identical ID's

This commit is contained in:
HB9HIL
2024-11-20 16:44:54 +01:00
parent 8f6bb9d97a
commit bf61fee980
3 changed files with 22 additions and 23 deletions

View File

@@ -154,7 +154,7 @@
<div class="mb-3 col-sm-6">
<label for="locator"><?= __("Gridsquare"); ?></label>
<input type="text" class="form-control" id="locator_edit" name="locator" value="<?php echo $qso->COL_GRIDSQUARE; ?>">
<small id="locator_info" class="form-text text-muted"><?php if ($qso->COL_DISTANCE != "") echo $qso->COL_DISTANCE . " km"; ?></small>
<small id="locator_info_edit" class="form-text text-muted"><?php if ($qso->COL_DISTANCE != "") echo $qso->COL_DISTANCE . " km"; ?></small>
</div>
<input type="hidden" name="distance" id="distance" value="<?php print ($qso->COL_DISTANCE != "") ? $qso->COL_DISTANCE : "0"; ?>">
@@ -185,7 +185,7 @@
<div class="row">
<div class="col-sm-6">
<label for="prop_mode"><?= __("Propagation Mode"); ?></label>
<select class="form-select" id="prop_mode" name="prop_mode">
<select class="form-select" id="prop_mode_edit" name="prop_mode">
<option value="" <?php if ($qso->COL_PROP_MODE == "") { echo "selected=\"selected\""; } ?>></option>
<option value="AS" <?php if ($qso->COL_PROP_MODE == "AS") { echo "selected=\"selected\""; } ?>><?= _pgettext("Propagation Mode", "Aircraft Scatter"); ?></option>
<option value="AUR" <?php if ($qso->COL_PROP_MODE == "AUR") { echo "selected=\"selected\""; } ?>><?= _pgettext("Propagation Mode", "Aurora"); ?></option>
@@ -217,7 +217,7 @@
<input type="hidden" class="form-control" id="country" name="country" value="<?php echo $qso->COL_COUNTRY; ?>">
<div class="mb-3 col-sm-6">
<label for="ant_path"><?= __("Antenna Path"); ?></label>
<select class="form-select" id="ant_path" name="ant_path">
<select class="form-select" id="ant_path_edit" name="ant_path">
<option value=""></option>
<option value="G" <?php if ($qso->COL_ANT_PATH == "G") { echo "selected=\"selected\""; } ?>><?= __("Greyline"); ?></option>
<option value="O" <?php if ($qso->COL_ANT_PATH == "O") { echo "selected=\"selected\""; } ?>><?= __("Other"); ?></option>

View File

@@ -162,7 +162,7 @@
$distance .= ' <span class="badge bg-secondary">' . __("Other Path") . "</span>";
break;
case "G":
$distance .= ' <span class="badge bg-secondary">' . __("Gray Line") . "</span>";
$distance .= ' <span class="badge bg-secondary">' . __("Greyline") . "</span>";
break;
default:
break;

View File

@@ -215,7 +215,7 @@ async function fill_if_empty(field, data) {
// catch special case for distance
if (field == "#distance" && $(field).val() == 0) {
$(field).val(data).css('border', border_color);
// $('#locator_info').html(data);
// $('#locator_info_edit').html(data);
}
if ($(field).val() == '' && data != '') {
@@ -287,8 +287,8 @@ function qso_edit(id) {
},
});
$('#prop_mode').change(function(){
if (unsupported_lotw_prop_modes.includes($('#prop_mode').val())) {
$('#prop_mode_edit').change(function(){
if (unsupported_lotw_prop_modes.includes($('#prop_mode_edit').val())) {
$('#lotw_sent').prop('disabled', true);
$('#lotw_rcvd').prop('disabled', true);
$('*[id=lotw_propmode_hint]').each(function() {
@@ -316,21 +316,21 @@ function qso_edit(id) {
}
});
$('#locator_edit, #ant_path').on('change', function(){
$('#locator_edit, #ant_path_edit').on('change', function(){
if ($('#locator_edit').val().length >= 4) {
$.ajax({
url: base_url + 'index.php/logbook/searchbearing',
type: 'post',
data: {
grid: $('#locator_edit').val(),
ant_path: $('#ant_path').val(),
ant_path: $('#ant_path_edit').val(),
stationProfile: $('#stationProfile').val()
},
success: function(data) {
$('#locator_info').html(data).fadeIn("slow");
$('#locator_info_edit').html(data).fadeIn("slow");
},
error: function() {
$('#locator_info').text("Error loading bearing!").fadeIn("slow");
$('#locator_info_edit').text("Error loading bearing!").fadeIn("slow");
},
});
$.ajax({
@@ -338,20 +338,19 @@ function qso_edit(id) {
type: 'post',
data: {
grid: $('#locator_edit').val(),
ant_path: $('#ant_path').val(),
ant_path: $('#ant_path_edit').val(),
stationProfile: $('#stationProfile').val()
},
success: function(data) {
$("#distance").val(data);
$("#distance").val(parseFloat(data));
},
error: function() {
$("#distance").val('');
$('#distance').val('');
},
});
} else if ($('#locator_edit').val().length == 0) {
$('#locator_info').fadeOut("slow");
$("#distance").val('');
$('#locator_info_edit').fadeOut("slow");
$('#distance').val('');
}
}).trigger('change'); // we also run this when the dom is ready, Trick 17 ;-)
@@ -365,10 +364,10 @@ function qso_edit(id) {
stationProfile: $('#stationProfile').val()
},
success: function(data) {
$('#locator_info').html(data).fadeIn("slow");
$('#locator_info_edit').html(data).fadeIn("slow");
},
error: function() {
$('#locator_info').text("Error loading bearing!").fadeIn("slow");
$('#locator_info_edit').text("Error loading bearing!").fadeIn("slow");
},
});
$.ajax({
@@ -379,15 +378,15 @@ function qso_edit(id) {
stationProfile: $('#stationProfile').val()
},
success: function(data) {
document.getElementById("distance").value = data;
$("#distance").val(parseFloat(data));
},
error: function() {
document.getElementById("distance").value = null;
$("#distance").val('');
},
});
} else if ($(this).val().length == 0) {
$('#locator_info').fadeOut("slow");
document.getElementById("distance").value = null;
$('#locator_info_edit').fadeOut("slow");
$("#distance").val('');
}
});