Julian Popov
Julian Popov

Reputation: 17461

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?

Upvotes: 0

Views: 1401

Answers (2)

Abiola Babatunde
Abiola Babatunde

Reputation: 81

There are some barcode scanner that will scan your barcode into the text box and hit process by itself it as if you hit Enter button. And there are many that will only scan then you will press enter button yourself. If you are using the second type that only scan, you can code your page to automatically press enter button if the character length in the textbox is 7 or 8. Enter Key code is 13.

Upvotes: 1

Treb
Treb

Reputation: 20281

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.

Upvotes: 3

Related Questions