Reputation: 309
I am developing a barcode reader application for personal use (inventory). The barcode reader I am using, acts like a keyboard, it inputs the barcode number and sends an "Enter". However, I always need to focus manually said text field.
I want to make the reader update the whole form of fields when it reads a barcode. Without having to place the focus manually on the field.
In order to do so, I was wondering if there's a way to determine if the keypress (or another event) came from the bar reader or from the keyboard?.
The development it's currently done under HTML/JS (jQuery) and PHP, but I'm not closed to other suggestions.
The barcode reader is plug and play, and didn't come with drivers. Is there a way to read the information on the device that is performing the input?
Upvotes: 0
Views: 356
Reputation: 70
You can try adding the autofocus attribute in the html.
http://www.w3schools.com/tags/att_input_autofocus.asp
Upvotes: 1
Reputation: 5048
As far as I know there is no way of differentiating a (generic) barcode reader from a real keyboard. You may solve your problem by adding a keypress handler on a page with code that sets focus to the field you need to put the value into.
Upvotes: 1