Search code examples
javascriptuser-interfacebarcodebarcode-scanner

Barcode scanner and 2 submit buttons


I have a website where an operator have to choose "Yes" or "No" button using barcode scanner

What is the recomendad way to do this?

May be it will be good to use 2 barcodes, one for "Yes" and one for "No" but what to do next?


Solution

  • The barcode scanners I know just register themselves on the computer as a usb keyboard. When you scan a barcode they convert that to a text string and send it to the computer, as if it was typed on a keyboard.

    Most scanners can be configured to automatically add a line end character to that string. Scanning the barcode of "YES" when an input field has the focus would then be the same as typing "YES" into that input box and hitting enter.

    So your approach of using 2 Barcodes, one for YES, one for NO, is the right start, IMO. The difficult part is in making certain that the input has the focus at that moment. Have a look at this question on SO to get you started.