I’m trying to use the barcode scanner plugin.
I have more than one field that receives the scanned value, and the amount of these fields can vary (1, 2, 3 fields …), depending on the configuration the user selects.
My problem is knowing which field called the scanner to fill the scanned value back, because the scan() method is asynchronous.
I tried to pass to the scanner plugin a parameter that indicates the field being scanned at the moment, however, I could not find that option. I also tried to run the scan() method synchronously (as in this post ), but the scanner does not open.
Does anyone have another solution?
so far I undestood you have a page with let’s say input field. Do you have a scan button for each input field or do you have just one scan button for all input fields?
If one per input you can handle it in the callback of scan().
if you have one scan() for all input field, how would you assign from a user perspective the code to the input? assign it by the focus? if so, you must save in a variable which input field is focused and then in the scan() callback save the result in the focused field…
Maybe I just understood you wrong. can you maybe give more details, or even code…