If i have a website running php and apache, what do i need to be able to attach a scanner to it? How do i get the scanner to fill in a value on one of the webforms on my page?
6 Answers
I just did this for an application. It's actually simple. The scanner is just another input method and is, in fact, similar to a keyboard. When you scan the barcode the data is decoded by the scanner and sent to whatever application is waiting to receive it. In the case of a web-based application it would be a form, most likely with a textarea with focus. The data would then populate the textarea just as if someone had typed the barcode's data into it. The form is then submitted and processed normally.
Just make sure the textarea has focus or else the data will go either nowhere or to wherever focus is (which may be another form field or the address bar).
I have yet to figure how how to get the form to auto-submit upon the entry of the barcode data as the scanner does not send event information (i.e. submit) and special characters such as tab (\t) do not seem to work. (If anyone knows how to accomplish this I am very interested in knowing how it can be done).
-
2use a text area instead of a textbox for the tabs. re autosubmit - use javascript to determine when user stops typing (usually .5s after he stops typing is good for a bar code scanner) May 24, 2010 at 20:34
-
4Unless you're dealing with random length barcodes, they'll have a fixed length, so some javascript to detect when the proper number of characters have been entered into the input field -> trigger submit.– Marc BMay 25, 2010 at 17:00
-
3Some scanners allow you to append special characters at the end/beginning of the input. I used this to append [ENTER] key. The form has a hidden submit button. Works pretty well. The only problem was if the focus was on the address bar or somewhere else. For this I used a JS loop to check and set the focus on the input element.– BogdanJun 6, 2010 at 17:32
For actually creating barcodes in PHP, you might want to have a look at:
Usually, these scanners are equivalent to a keyboard input, so you just select the appropriate input point on the web page, scan, and then submit the form.
WASP makes a line of barcode scanners that simply plug into USB or PS/2 inputs and basically convert the barcode scanned into the characters, just like a user typed them using a keyboard. They have an FAQ and help videos that may be of assistance, too.
When designing your web app, depending on how users interact with it, you can use Javascript to move focus from one field to another so that a user can scan barcodes sequentially without having to click on the field where the characters go. (Similar to how some forms move focus as you type data with a known length, such as a zip code or phone number.)
You can try this:
I think this is the best way to integrate barcode in web application using php.
integrating barcode scanner into php application?
I hope this link is usefull to all.
Using an autofucus input is the better way. You just have to make sure that you create a for and add autofocus to the input box. So each time a user scans any item, the form is automatically submitted. So just give the form an id and handle the data easily with jquery