如何限制表单以角度方式读取qrcode或条形码到特定文本框。 [英] How to restrict a form to read qrcode or barcode to a specific textbox in angular.

查看:133
本文介绍了如何限制表单以角度方式读取qrcode或条形码到特定文本框。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道QRCode或条形码可以在任何地方读取,我们放置光标的地方不应该是它应该读取到特定的texbox而其他表格元素不应该接受QrCode或条形码模式。



我尝试过:



As we know QRCode or Barcode can be read anywhere, where we place the cursor its should not be like that it should read to a specific texbox and other form elements should not accept QrCode or Barcode pattern.

What I have tried:

As we know QRCode or Barcode can be read anywhere, where we place the cursor its should  not be like that it should read to a specific texbox and other form elements should not accept QrCode or Barcode pattern.

推荐答案

问题不在于Angular或任何框架 - 大多数条码扫描器都是为了模拟键盘而设置的,并将他们扫描的数据直接放入键盘队列中。由于队列不记录源,它只是看起来像键盘数据,并且您无法自动将其切换到任何特定位置,因为您无法分辨用户键入的内容以及实际扫描的内容 - 并且没有你可以把它放在特别的地方!



有一个解决方案:你可以告诉大多数扫描仪提供引入和尾随序列您的代码可以正确识别和指导输入。不幸的是,告诉扫描仪的过程对于每个制造商来说是不同的(甚至在某些情况下对于每个模型)并且代码也不一定是固定的或定义的。

所以从扫描仪制造商开始,找出如何提供头尾序列,从那里它应该相当简单。
The problem is not Angular or any framework - it's that most barcode scanners ship set up to emulate a keyboard, and put the data they scan directly into the keyboard queue. Since the queue does not record the source, it just looks like keyboard data, and you can't automatically switch it to any specific location, because you can't tell what was typed by the user, and what was actually scanned - and without that, you can;t put it anywhere special!

There is a solution: you can tell most scanners to provide a "lead in" and "tail out" sequence that your code can identify and direct input appropriately. Unfortunately, the process of telling the scanner is different for each manufacturer (and even for each model in some cases) and the codes are not necessarily fixed or defined either.
So start with the scanner manufacturer and find out how to provide head and tail sequences, from there it should be fairly simple.


这篇关于如何限制表单以角度方式读取qrcode或条形码到特定文本框。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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