如何使用条形码阅读器在 HTML 表单中填写两个输入[文本]?

发布于 2024-08-17 20:13:33 字数 402 浏览 2 评论 0原文

我有一个网页,其中包含一个用于条形码内容的输入文本和一个用于条形码类型的选择

因此,使用数据库,可以生成格式良好的条形码。

普通的最终用户不知道哪个条形码是哪种类型,但是条形码读取器知道并且可以将该类型作为键盘输入发送。

问题是我不知道如何从输入更改为选择。

如果我使用 \t,它会在输入中打印列表,而不是从一个输入切换到另一个输入。如果我使用 \n 它会提交表单。

您知道我该如何做才能使我的表格可以在有或没有条形码阅读器的情况下使用吗?

它可以打印条形码,后跟条形码类型 6931442700194|EAN13 并在处理表单时拆分内容,但还有其他解决方案吗?

I have a web page with one input text for the barcode content and a select for the barcode type.

So using the database, it is possible to generate the barcode in the good format.

A normal final user don't know which barcode as which type, but the barcode reader knows and can send this type as a keyboard input.

The problem is that I don't know how to change from the input to the select.

If I use, the \t, it prints a tabulation in the input instead of switching from a input to the other. If I use a \n it submit the form.

Do you have any idea of how I can do it so that my form can be use with or without the barcode reader?

It could print the barcode followed with the barcode type 6931442700194|EAN13 and split the content when processing the form but is there another solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晚雾 2024-08-24 20:13:33

您可以使用一些 Javascript 和 onchange 事件(或一些类似的事件)来检测您的输入文本的值已更改(由您的条形码阅读器更改)。然后,您获取该值并将其拆分到您的输入文本选择上。

<input type='text' id='inputtext' onchange='splitValue();' />
<select id='myselect'>...</select>

和 JavaScript

function splitValue()
{
    var input=document.getElementById('inputtext');
    var select=document.getElementById('myselect');
    var test = input.value;

    // Perform some splitting and formatting

    input.value = splitted_inputvalue;
    select.value = splitted_selectvalue;
}

You can use some Javascript and the onchange event (or some similar event) to detect the value of your input text has been changed (by your barcode reader). Then you get this value and split it over your input text and select.

<input type='text' id='inputtext' onchange='splitValue();' />
<select id='myselect'>...</select>

And the JavaScript

function splitValue()
{
    var input=document.getElementById('inputtext');
    var select=document.getElementById('myselect');
    var test = input.value;

    // Perform some splitting and formatting

    input.value = splitted_inputvalue;
    select.value = splitted_selectvalue;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文