Open kcviper opened 7 years ago
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).
I am with kcviper on this one, what if the user scans multiple codes in the same form.
Any work around?
You mean each time he scans, the code should go in the next input ?
exactly! I am currently trying to make it work
You could set the plugin in one input and implement the onScan
so it fills the next empty input
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
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
managed to do something similar, thank you very much!
I'm having issues with multiple textboxes to execute different scripts. Because right now when selecting one textbox, it's executing all textboxes scripts.