mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
[Contesting] Adds Validation to the serial input fields
This commit adds validation to the input fields, so that serial can only be a number and other can be freeform text. Co-Authored-By: m0pcb <60575997+m0pcb@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,14 @@ $("#exch_sent").val(1);
|
||||
$( document ).ready(function() {
|
||||
restoreContestSession();
|
||||
setRst($("#mode").val());
|
||||
|
||||
// Check to see what serial type is selected and set validation
|
||||
if($('#serial').is(':checked')) {
|
||||
set_serial_number_input_validation();
|
||||
}
|
||||
if($('#other').is(':checked')) {
|
||||
set_other_input_validation();
|
||||
}
|
||||
});
|
||||
|
||||
// This erases the contest logging session which is stored in localStorage
|
||||
@@ -169,4 +177,36 @@ $('#band').change(function() {
|
||||
$('#frequency').val(result);
|
||||
$('#frequency_rx').val("");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Change Serial Validation when selected
|
||||
$('#serial').change(function() {
|
||||
if($('#serial').is(':checked')) {
|
||||
set_serial_number_input_validation();
|
||||
}
|
||||
});
|
||||
|
||||
// Change other serial type when selected
|
||||
$('#other').change(function() {
|
||||
if($('#other').is(':checked')) {
|
||||
set_other_input_validation();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
Function: set_serial_number_input_validation
|
||||
Job: This sets the field input to number for validation
|
||||
*/
|
||||
function set_serial_number_input_validation() {
|
||||
$('#exch_sent').attr('type', 'number');
|
||||
$('#exch_recv').attr('type', 'number');
|
||||
}
|
||||
|
||||
/*
|
||||
Function: set_other_input_validation
|
||||
Job: This sets the field input to text for validation
|
||||
*/
|
||||
function set_other_input_validation() {
|
||||
$('#exch_sent').attr('type', 'text');
|
||||
$('#exch_recv').attr('type', 'text');
|
||||
}
|
||||
Reference in New Issue
Block a user