条码扫描器和输入字段,将新的线路呼叫替换为标签呼叫? [英] Barcode scanner and input fields, replace new line call to tab call?

查看:129
本文介绍了条码扫描器和输入字段,将新的线路呼叫替换为标签呼叫?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,条形码扫描仪每次扫描结束时都会显示一个回车符,通过提交它们来混淆表单。是否有可能改变它,以便它调用一个选项卡(从而移动到下一个输入字段)?

我在这里找到了一个解决方案,但是,它使用他们的ID手动对每个输入进行聚焦。我有的输入数量是可变的,所以我不能这样做。

解决方案

是的,这是可能的。有两种方法:


  1. 重新编程条形码读取器以发送 TAB 键代替在读取条形码后返回回车

  2. 使用javascript捕获提交事件并检查表单状态。要么阻止提交并将焦点移到下一个字段,要么允许提交事件根据表单状态继续。


So barcode scanners end each scan with a carriage return, which messes up forms by submitting them. Is it possible to change this so that it calls a tab instead (thus moving to the next input field)?

I did a find a solution here that does that, but it manually focused on each input using their id's. The number of inputs I have is variable so I cannot do that.

解决方案

Yes, it is possible. There are 2 ways:

  1. reprogram the barcode reader to send the TAB key instead of a carriage return after reading a barcode
  2. use javascript to capture the submit event and inspect the form state. Either prevent submit and move focus to the next field or allow the submit event to continue based on the form state.

这篇关于条码扫描器和输入字段,将新的线路呼叫替换为标签呼叫?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆