How to prohibit form submit when using a barcode scanner?

How to prohibit form submit when using a barcode scanner?

  

I need to use a barcode scanner to enter data into a input field. When I do this it also submits my form. How can I do this so the form doesn't submit?

Hi Anthony,

Can you share your module?

Hi Anthony,

Some barcode scanners send a command after the barcode content that is interpreted as a "Return" or "Enter". This might be the cause of your problem. My suggestion is to configure your scanner not to send this command or to use javascript to intercept and cancel the command (some examples here).

Solution

I found a solution in a similar thread.
I added a hidden button and set its "Is Default" property to True instead of my actual submit button.
Now when I scan a bar code for field entry "which seems to also send an ENTER cmd" it no longer submits my form as the default button is not accessible.

Solution