mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Validate call sign before sending to modem.
This commit is contained in:
parent
1c4402094a
commit
f67f62f3ad
2 changed files with 17 additions and 4 deletions
|
@ -1,5 +1,17 @@
|
|||
<script setup lang="ts">
|
||||
import { settingsStore as settings, onChange } from "../store/settingsStore.js";
|
||||
import { settingsStore as settings, onChange, getRemote } from "../store/settingsStore.js";
|
||||
import {validateCallsignWithSSID, validateCallsignWithoutSSID} from "../js/freedata";
|
||||
function validateCall()
|
||||
{
|
||||
if (validateCallsignWithoutSSID(settings.remote.STATION.mycall))
|
||||
//Send new callsign to modem if valid
|
||||
onChange();
|
||||
else
|
||||
//Reload settings from modem as invalid callsign was passed in
|
||||
getRemote();
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<!-- station callsign -->
|
||||
|
@ -14,8 +26,9 @@ import { settingsStore as settings, onChange } from "../store/settingsStore.js";
|
|||
id="myCall"
|
||||
aria-label="Station Callsign"
|
||||
aria-describedby="basic-addon1"
|
||||
@change="onChange"
|
||||
v-model="settings.remote.STATION.mycall"
|
||||
@change="validateCall"
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ export function sortByPropertyDesc(property) {
|
|||
* @returns true or false if callsign appears to be valid with an SSID
|
||||
*/
|
||||
export function validateCallsignWithSSID(callsign: string) {
|
||||
var patt = new RegExp("^[A-Z,a-z]+[0-9][A-Z,a-z]*-(1[0-5]|[0-9])$");
|
||||
var patt = new RegExp("^[A-Z]+[0-9][A-Z]*-(1[0-5]|[0-9])$");
|
||||
|
||||
if (
|
||||
callsign === undefined ||
|
||||
|
@ -82,7 +82,7 @@ export function validateCallsignWithSSID(callsign: string) {
|
|||
* @returns true or false if callsign appears to be valid without an SSID
|
||||
*/
|
||||
export function validateCallsignWithoutSSID(callsign: string) {
|
||||
var patt = new RegExp("^[A-Za-z]+[0-9][A-Za-z]+$");
|
||||
var patt = new RegExp("^[A-Z]+[0-9][A-Z]+$");
|
||||
|
||||
if (
|
||||
callsign === undefined ||
|
||||
|
|
Loading…
Reference in a new issue