From 8c94e739f5ff131913d3ec9da12fbf7e3f7d58ba Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Mon, 12 Feb 2024 01:14:22 +0100 Subject: [PATCH 1/2] js to prevent chars in serial --- assets/js/sections/contesting.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js index bd8931d29..344575f93 100644 --- a/assets/js/sections/contesting.js +++ b/assets/js/sections/contesting.js @@ -137,6 +137,20 @@ $(function () { }); }); +// Some Browsers (Firefox...) allow Chars in Serial Input. We don't want that. +// reference: https://stackoverflow.com/questions/49923588/input-type-number-with-pattern-0-9-allows-letters-in-firefox +$(function () { + $('#exch_serial_s, #exch_serial_r').on('keypress', function (e) { + var charCode = e.which || e.keyCode; + var charStr = String.fromCharCode(charCode); + + if (!/^[0-9]+$/.test(charStr)) { + e.preventDefault(); + } + }); +}); + + // Here we capture keystrokes to execute functions document.onkeyup = function (e) { // ALT-W wipe From b966e15d5e782fa9996d3414127cf634be3fa9e7 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Mon, 12 Feb 2024 18:13:56 +0100 Subject: [PATCH 2/2] avoid negative serial --- application/views/contesting/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/contesting/index.php b/application/views/contesting/index.php index c85e90664..6b8f77cf6 100644 --- a/application/views/contesting/index.php +++ b/application/views/contesting/index.php @@ -113,7 +113,7 @@