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 textbox #3

Open
kcviper opened this issue Jul 20, 2017 · 8 comments
Open

Multiple textbox #3

kcviper opened this issue Jul 20, 2017 · 8 comments

Comments

@kcviper
Copy link

kcviper commented Jul 20, 2017

I'm having issues with multiple textboxes to execute different scripts.
Because right now when selecting one textbox, it's executing all textboxes scripts.

@Glideh
Copy link
Owner

Glideh commented Jul 20, 2017

Well if you focus your inputs before scanning you don't need this plugin.
The input will be filled as if you typed with the keyboard.
The aim of this plugin is to catch a scanned code without any previous user action (ie selecting an input).

@LuisRodriguezLD
Copy link

I am with kcviper on this one, what if the user scans multiple codes in the same form.

Any work around?

@Glideh
Copy link
Owner

Glideh commented Feb 18, 2019

You mean each time he scans, the code should go in the next input ?

@LuisRodriguezLD
Copy link

exactly! I am currently trying to make it work

@Glideh
Copy link
Owner

Glideh commented Feb 18, 2019

You could set the plugin in one input and implement the onScan so it fills the next empty input

@LuisRodriguezLD
Copy link

yes that works great but what if I have multiple barcodes to scan on different inputs. the onScan fires for all of them at the same time

@Glideh
Copy link
Owner

Glideh commented Feb 18, 2019

No you put the plugin only on one input responsible for all the others.
The input on which the plugin is set is not important (you can even put it in the form)
The important thing is your implementation of onScan

Example:

<form id="your_form">
  <input type="text" class="scanable">
  <input type="text" class="scanable">
  <input type="text" class="scanable">
  <input type="text" class="scanable">
</form>
$('#your_form').codeScanner({
    onScan: function ($element, code) {
        $element.find('input.scanable[value=""]').first().val(code);
    }
});

Not tested but should work

@LuisRodriguezLD
Copy link

managed to do something similar, thank you very much!

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

3 participants