Search code examples
asp.netkeyboardbarcodebarcode-scanner

Bar Code Scanner and Keyboard Issue


Bar Code Scanner and Keyboard. NOTE: My Bar Code Scanner is USB Type. enter image description here

Then... enter image description here

What function must be use to trigger the keyboard if i'm at auto.aspx page? I tried this code but no success:

var barcode = document.getElementById('barcodenum');
barcode.addEventListener("keypress", function() { alert("Please use Barcode Scanner!"); document.getElementById('barcodenum').value = "";}, true);  

Solution

  • As pointed out by @Robert Skarzycki above, i doubt you can integrate with the scanner using a web page.

    On the keypress intercept issue.

    Add this to the head section of you page.

      <script type="text/javascript">
    
            window.onload = function() {              
                var barcode = document.getElementById('barcodenum');
                barcode.addEventListener("keyup", function() {
                    alert("Please use Barcode Scanner!");
                    document.getElementById('barcodenum').value = "";
                }, true);
            };
    
        </script>