I Have a Form That Uses a Generic Bluetooth Scanner that pastes the numeric barcode into the text field.
If I Test it out and scan a text barcode it converts it to a number on a tablet. On The Desktop it does what I have it programmed to do and error out. I'm confused by it.
I use Chrome on Both the Desktop and on the Tablet. Any Help Appreciated.
Here is my JS Function:
function isNumeric(num) {
return !isNaN(parseInt(num));
}
var success = new Audio('../templates/success.mp3');
var error = new Audio('../templates/error.mp3');
function check_bin() {
var bin = document.getElementById("bin").value;
document.getElementById("alert_move_bin").className = "";
document.getElementById("alert_move_bin").innerHTML = "";
document.getElementById("bin_group").className = "form-group";
document.getElementById("barcode_group").className = "form-group";
if (isNumeric(bin) == true) {
if (bin < 15 || bin > 6000) {
document.getElementById("bin_group").className = "form-group has-error";
document.getElementById("sub").disabled = true;
document.getElementById("bin").value = "";
document.getElementById("bin").focus();
error.play();
return false;
} else {
document.getElementById("bin_group").className = "form-group has-success";
document.getElementById("sub").disabled = false;
document.getElementById("location").focus();
return false;
}
} else {
error.play();
document.getElementById("bin_group").className = "form-group has-error";
document.getElementById("sub").disabled = true;
document.getElementById("bin").value = "";
document.getElementById("bin").focus();
}
}
HTML
<!-- Text input-->
<div class="form-group" id="bin_group">
<label class="control-label" for="bin">Bin Number</label>
<input data-fv-onsuccess="bin_success" data-fv-onerror="bin_error" data-fv-onsuccess="onFieldSuccess" data-fv-stringlength="true" data-fv-stringlength-max="4" data-fv-stringlength-message="The bin number must be more than 2 and less than 4 numbers long" data-fv-stringlength-min="2" data-fv-notempty="true" data-fv-notempty-message="The Bin # is required" id="bin" name="bin" type="number" placeholder="" class="form-control nput-lg bigger_text" autofocus>
</div>
<!-- Text input-->
<div class="form-group" id="barcode_group">
<label class="control-label" for="location">Bin Location</label>
<input onpaste="bin_location_changed();" onchange="bin_location_changed();" data-fv-notempty="true" data-fv-notempty-message="The New Bin Location is required" id="location" name="location" type="text" placeholder="" class="form-control nput-lg bigger_text">
</div>
Aucun commentaire:
Enregistrer un commentaire