gui related gridsquare validation

pull/996/head
DJ2LS 2025-08-30 10:21:14 +02:00
parent 596fe97744
commit 800c40661d
3 changed files with 32 additions and 11 deletions

View File

@ -114,16 +114,18 @@
<i class="bi bi-question-circle" />
</button>
</span>
<input
id="myGrid"
v-model="settings.remote.STATION.mygrid"
type="text"
class="form-control"
:placeholder="$t('settings.station.locator_placeholder')"
maxlength="6"
aria-label="Station Grid Locator"
@change="onChange"
>
id="myGrid"
v-model="settings.remote.STATION.mygrid"
type="text"
class="form-control"
:placeholder="$t('settings.station.locator_placeholder')"
maxlength="6"
aria-label="Station Grid Locator"
@change="checkGridsquare"
/>
</div>
<!-- Respond to CQ Callings -->
@ -220,7 +222,7 @@ import { onMounted } from "vue";
import { settingsStore as settings, onChange, getRemote } from "../store/settingsStore.js";
import { validateCallsignWithoutSSID } from "../js/freedata";
import * as bootstrap from "bootstrap";
import i18next from "../js/i18n";
// Initialize Bootstrap tooltips
onMounted(() => {
@ -228,6 +230,25 @@ onMounted(() => {
[...tooltipTriggerList].forEach(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
});
function checkGridsquare(e) {
let value = e.target.value.trim();
const regex = /^[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2})?$/;
if (regex.test(value)) {
let formatted =
value.substring(0, 2).toUpperCase() +
value.substring(2, 4) +
(value.length === 6 ? value.substring(4, 6).toLowerCase() : "");
settings.remote.STATION.mygrid = formatted;
onChange();
} else {
alert(i18next.t('settings.station.locator_error'));
}
}
// Function to validate and update callsign
function validateCall() {
let call = settings.remote.STATION.mycall;

View File

@ -242,6 +242,7 @@
"callsignssid_help": "Set a SSID for this station",
"locator": "Grid Locator / Maidenhead",
"locator_help": "Enter a grid locator (Max 6 chars; shorter will randomize)",
"locator_error": "Enter a correct grid locator, like JN12ea or JN12!",
"locator_placeholder": "Your grid locator",
"respondtocq": "Respond to CQ callings with a QRV reply",
"respondtocq_help": "QRV reply sent with random delay",

View File

@ -109,7 +109,6 @@ export const settingsStore = reactive({ ...defaultConfig, local: localConfig });
// Function to handle remote configuration changes
export function onChange() {
console.log("hier sind wir.....");
let remote_config = settingsStore.remote;
let blacklistContent = remote_config.STATION.callsign_blacklist;
// Check if the content is a string