Closed smartmeter closed 8 years ago
Hi Smartmeter,
Thanks for your feedback. I will try to update the lib to work with latest version of JQuery.
It would be helpful to know:
To answer your questions:
First: There should be no need to $("input:first").focus()
. One feature of this library is that there is no need to focus inputs to catch barcode scans, the web browser just have to be focused (open) when you scan, the library does the rest.
I have a scenario where the user may scan one, or many scans like a shopping cart, so I have put it in a textbox or listbox will the target work with a listbox. How can I achieve this where each item is separate.
many scans should be possible, you just have to take care to cache each scan individually. There is also no need for form elements at all (only if you need them for fallback reasons, like keep your webapp available for users without a scanner):
BarcodeScanner.addAction("c (id)", function(id) {
console.log(this); // the current input/textarea that is the barcode target
console.log(id); // 2121232
});
So if you want to keep input fields just take care to catch every submit of the surrounding form element:
<form>
<input data-barcode-scanner-target type='text'></input>
</form>
$('form').on('submit', function(e){
e.preventDefault();
do_something_else();
});
If I have 2 input boxes, how does the scan know which one to put it in.
You have to use custom actions to handle this case: https://github.com/pape-io/barcode-scanner.js#add-custom-actions
Or if it is a two steps procedure, you have to disable the first input field as soon as its filled by the bar code scanner. Then it will put the second scan it the second input and so on
Can this also scan characters, and which libs are supported. For e.g. if I have 2 types of codes Parts P0938823 and Fluids F0238847 would the scanner pick up the P and F
With custom actions, you can define certain patterns in your barcodes:
BarcodeScanner.addAction("P(id)", function(id) {
console.log("I do something with the PART: "+id);
});
BarcodeScanner.addAction("F(id)", function(id) {
console.log("I do something with the FLUID: "+id);
});
how does it know which barcode standard to use. I mean is this a configuration in the lib or the scanner prefix codes.
It only works with barcode scanners that produce character outputs. As a website can deal with any kind of character, this is how it works.
Your barcode scanner knows the standard, this library just deals with the character output.
how can I trigger an Ajax silent POST on every scan. is it possible?
Just use jquery for it: https://api.jquery.com/jquery.post/
Is this auto submitted when I hit scan? I do not see a submit, or is it a separate user action, where they click submit button.
By default it is auto-submitting the surrounding form element, as described here: https://github.com/pape-io/barcode-scanner.js#inputdata-barcode-scanner-target
Hi Pape, thanks for taking the time, this is a very nice lib, after looking at other including others (quite a few https://github.com/lindell/JsBarcode https://github.com/serratus/quaggaJS ) I found yours to make most sense , easy for novice like me :+1:
Thanks for the custom action, I will post the code, let me get it to a decent working and cleaned up point... embarrassed right now :)
1 My scanner is not pulling the P or F
in the scan code with your lib, is this because of the protocol or are letters not supported.
2 Ver: I am using Jquery 1.11 because my users have IE 8
3 http://www.ciax.com/manuals/ref_app/values.htm , the first four seem to work for me, since they're ASCII mostly. Since, I am using my own numbering which one do you recommend for easy and quick test with this (I will share code soon)
4 In scanner do you prefer HID, I was told that has the best wedging? can you share some information around scanners, USB or WIFI
5 Is there an checksum or something like http://www.azalea.com/faq/code-39/
6 I saw your tesseract, is this integrated with that? Sometime user is taking a picture and they want to decode form pic.
7 On multiple scans, it auto populates in serial, one after another correct, like your test file included in the sample.
8 Can you please tell in the JS/coffee code file, how to look at where is the scanner detected, I want to see if the scanner has issues on wedging or the prefix, is there an option to turn on so we can see where it is. Also, can you tell me where this is happening, so I can debug please.
Here he voiced some frustration and posted a sample, I thought from my search it would help your lib http://www.deadosaurus.com/detect-a-usb-barcode-scanner-with-javascript/
Hi, for me on disconnects
<form>
<input data-barcode-scanner-target type='text' class="pape-save-offline-barcode"></input>
</form>
$('form').on('submit', function(e){
e.preventDefault();
SaveToOffline();
SeverBatchUpload();
});
totally bombs out on me,would be supeer sweet, if this was an option
hey saw this #3 Can this also scan characters, and which libs are supported. For e.g. if I have 2 types of codes Parts P0938823 and Fluids F0238847 would the scanner pick up the P and F
I have both UPC and serial numbers on various commodities from the grocery store and hardware store, does this scan work with both? and will it tell me the correct type?
@smartmeter: Tesseract has nothing to do with this library, it is also not integrated in barcode-scanner.js and to be honest, tesseract has nothing to do with pictures ;)
So guys, appreciate all the questions, but I had to cleanup this issue.
I moved all the question to separate issues: Github Issues
Please try to open a new issue, for every new topic, question, as it helps me answering the questions and having an overview. It will also help others to find the right answers to similar questions.
I also cleanup the README a little bit, maybe that helps understanding certain stuff.
I will come up with a live demo, where you can test your scanners in the next days/weeks, so stay tuned.
So here is the demo page: https://htmlpreview.github.io/?https://github.com/pape-io/barcode-scanner.js/blob/master/demo.html
Hello, this is great little nugget, :+1: love the lib. I am trying to use it with my web app. (with the current version of Jquery it sometimes does not scan, can you please update).
<form> <input name='Checkout Item' type='text'></input> <input name='Barcode' data-barcode-scanner-target type='text'></input> </form> $("input:first").focus()
textbox
orlistbox
will the target work with a listbox. How can I achieve this where each item is separate.P0938823
and FluidsF0238847
would the scanner pick up the P and FPOST
on every scan. is it possible?thanks