Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple scans, listbox trigger submit and trigger event to AJAX. #3

Closed
smartmeter opened this issue Nov 26, 2015 · 12 comments
Closed

Comments

@smartmeter
Copy link

Hello, this is great little nugget, 👍 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).

`



$("input:first").focus()` 1. 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. 2. If I have 2 input boxes, how does the scan know which one to put it in. 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 4. how does it know which barcode standard to use. I mean is this a configuration in the lib or the scanner prefix codes. 5. how can I trigger an Ajax silent `POST` on every scan. is it possible? 6. 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.

thanks

@10xSebastian
Copy link
Owner

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:

  1. Which exact version of jquery you're talking about
  2. You share some code of the app you're talking about (or a link to check it out)

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();
});

@10xSebastian
Copy link
Owner

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

@10xSebastian
Copy link
Owner

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);
});

@10xSebastian
Copy link
Owner

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.

@10xSebastian
Copy link
Owner

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/

@10xSebastian
Copy link
Owner

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

@smartmeter
Copy link
Author

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 👍

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/

@unitedbummersconference
Copy link

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

@winecraft
Copy link

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?

@10xSebastian
Copy link
Owner

@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 ;)

@10xSebastian
Copy link
Owner

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.

@10xSebastian
Copy link
Owner

So here is the demo page: https://htmlpreview.github.io/?https://github.com/pape-io/barcode-scanner.js/blob/master/demo.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants