mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #124 from HB9HIL/contesting_chars_serial
[CONTESTING] Prevent Chars in Serial Number
This commit is contained in:
@@ -113,7 +113,7 @@
|
||||
|
||||
<div style="display:none" class="mb-3 col-md-1 serials">
|
||||
<label for="exch_serial_s"><?php echo lang('contesting_exchange_serial_s'); ?></label>
|
||||
<input type="number" class="form-control form-control-sm" name="exch_serial_s" id="exch_serial_s" value="">
|
||||
<input type="number" class="form-control form-control-sm" name="exch_serial_s" id="exch_serial_s" min="0" value="">
|
||||
</div>
|
||||
|
||||
<div style="display:none" class="mb-3 col-md-1 exchanges">
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
<div style="display:none" class="mb-3 col-md-1 serialr">
|
||||
<label for="exch_serial_r"><?php echo lang('contesting_exchange_serial_r'); ?></label>
|
||||
<input type="number" class="form-control form-control-sm" name="exch_serial_r" id="exch_serial_r" value="">
|
||||
<input type="number" class="form-control form-control-sm" name="exch_serial_r" id="exch_serial_r" min="0" value="">
|
||||
</div>
|
||||
|
||||
<div style="display:none" class="mb-3 col-md-1 exchanger">
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user