Pressing the reset button on the QSO page resets all the correct fields

pull/307/head
Peter Goodhall 2019-06-24 16:13:51 +01:00
rodzic 59ccc02fa1
commit 914a815aef
2 zmienionych plików z 11 dodań i 8 usunięć

Wyświetl plik

@ -193,13 +193,8 @@ $(document).ready(function(){
}
});
jQuery(function($) {
var input = $('#callsign');
input.on('keydown', function() {
var key = event.keyCode || event.charCode;
if( key == 8 || key == 46 ) {
console.log("trigger");
function reset_fields() {
$('#callsign_info').text("");
$('#locator_info').text("");
$('#country').val("");
@ -216,6 +211,15 @@ $(document).ready(function(){
mymap.setView([51.505, -0.09], 13);
mymap.removeLayer(markers);
}
jQuery(function($) {
var input = $('#callsign');
input.on('keydown', function() {
var key = event.keyCode || event.charCode;
if( key == 8 || key == 46 ) {
reset_fields();
}
});
});
@ -241,7 +245,6 @@ $(document).ready(function(){
// Set Map to Lat/Long
markers.clearLayers();
if (typeof result.latlng !== "undefined") {
console.log("defined!");
var marker = L.marker([result.latlng[0], result.latlng[1]]);
mymap.setView([result.latlng[0], result.latlng[1]], 8);
} else {

Wyświetl plik

@ -270,7 +270,7 @@
<input size="20" id="country" type="hidden" name="country" value="" />
</div>
<button type="reset" class="btn btn-light">Reset</button>
<button type="reset" class="btn btn-light" onclick="reset_fields()">Reset</button>
<button type="submit" class="btn btn-primary"><i class="fas fa-save"></i> Save QSO</button>
</div>
</form>