Blazor handheld barcode scanner with hidden field

Viewed 27

I'm working on a Blazor app that can take input from a handheld barcode scanner. (USB connected)

I already have a first draft ready, but I can't seem to get this to work with hidden input fields. So basically, I want to catch the barcode in a hidden input field. This will be the only input field on the screen and should get the focus. I can manage everything when the input field is visible on the screen (set focus and scan a barcode) But as soon as I hide the input field, it doesn't work anymore.

1 Answers

This is maybe not the answer you are looking for, but it is my suggestion. Don't hide the input. I've worked on half a dozen systems with handheld barcode scanners, and every one of them allowed scanning with the barcode scanner OR entering the input manually.

There are going to be times that the barcode is damaged, and someone needs to enter it manually, or where you need to enter a barcode to the system remotely while testing or diagnosing a production issue.

Also, according to MDN, the user is specifically not supposed to edit hidden input values (I am assuming you are using input tags with a hidden type, and not a text input that is just hidden from the UI). What you are asking to do in your question, isn't supposed to work:

This specifically can't be edited or seen by the user via the user interface

Related