在 Windows Phone 上 - 条码扫描仪自动传递数据表单 (HTML)

发布于 2024-11-19 17:48:45 字数 890 浏览 3 评论 0原文

我之前在这里问过这个问题:

Stop user from using Enter to pass一个表单

,我已经设法让回车键不传递表单,但这还不足以解决问题。我使用的是 Windows 手机,并使用 Datawedge 传递扫描的条形码到一个表格。一旦我扫描了 SKU,它就会自动通过并输入。这很烦人,因为我还有其他几个区域用户需要输入。

如果有人有任何想法,我将非常感激。如果错误发生在表单侧,则代码如下:

<div class="search">        

  <form action="search.php" method="post">

    Search by SKU:<br />

      <input  id="entry" type="text" name="sku" />

        <br />

    Search by Description:<br />

      <input id="entry" type="text" name="desc" />

        <br />

      <input id="sub" type="submit" />

  </form>

这就是发生错误的地方。

希望你能帮忙。

I previously asked this question here:

Stop user from using enter to pass a form

and I had managed to get the enter key to not pass a form but that wasn't enough to fix the issue. I'm on a Window's phone and using Datawedge to pass scanned barcodes to a form. Once I scan an SKU though it is automatically passed through and entered. This is annoying as I have several other areas users will need to type in.

If anyone has any ideas I would really appreciate it. In the case that the error is form side here is the code for that:

<div class="search">        

  <form action="search.php" method="post">

    Search by SKU:<br />

      <input  id="entry" type="text" name="sku" />

        <br />

    Search by Description:<br />

      <input id="entry" type="text" name="desc" />

        <br />

      <input id="sub" type="submit" />

  </form>

This is where it is happening.

Hope you can help.

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

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

发布评论

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

评论(2

爱已欠费 2024-11-26 17:48:45

我在这里只是做一个猜测,因为我手头没有运行WinMo的测试设备,但由于你没有明确提到它,你是否禁用了DataWedge的AutoEnter功能?

[HKEY_CURRENT_USER\Software\Symbol\DataWedge\Barcode]

AutoEnter

dword

设置是否应在条形码之后(以及任何选定的后缀之后)发送 ENTER 键(VK_RETURN 虚拟键代码)
0 = 不发送 ENTER 键
1 = 发送 ENTER 键

I'm only making a guess here, since i haven't got a test device at hand running WinMo, but since you didn't explicitly mention it, did you disable the AutoEnter function of DataWedge?

[HKEY_CURRENT_USER\Software\Symbol\DataWedge\Barcode]

AutoEnter

dword

Sets whether or not an ENTER key (VK_RETURN virtual key code) should be sent after the barcode (and after any selected suffix)
0 = do not send ENTER key
1 = send ENTER key

安静被遗忘 2024-11-26 17:48:45

我之前在接受条形码输入的 Intranet 站点上遇到过这个问题。

虽然我的直觉可能会发生一些特殊的事情,即您最初的想法是正确的,但捕获回车键将解决问题。

我注意到的一件事是,虽然很简单,但捕获回车键可能有点挑剔。您是否能够在 Windows Phone 之外测试您的页面,以验证输入时提交是否真正被禁用?

如果是这样,您是否尝试过在输入捕获功能中添加警报,以查看在使用 Windows Mobile 时它是否能够正确命中?

你可能想尝试一下 -
(如果您不使用 jquery,您将用 body onkeypress 替换 $() 代码)

    <script type="text/javascript">
                    function disableEnterKey(e) {
                        var key;
                        if (window.event)
                            key = window.event.keyCode; 
                        else
                            key = e.which; 

                        if (key == 13)
                            return false;
                    }

                    $(function () {
                        document.onkeypress = disableEnterKey;
                    });

   </script>

如果我重新整理您已经彻底消除的内容,我深表歉意。我只知道我经历了类似的过程并最终回到了 javascript 解决方案。

I've encountered this problem before a on an intranet site that accepted bar code input.

While it is possible something special is going on my instinct is that your initial thought is correct, capturing the enter press will solve the issue.

One thing I've noticed is that for as simple as it is, capturing the enter press can be a bit finicky. Were you able to test your page outside of windows phone to verify that submit on enter was truly disabled?

If so have you tried putting an alert in enter capture function to see if it is getting hit correctly once you are on windows mobile?

You may want to give this a shot -
(You'll replace the $() code with a body onkeypress if you aren't using jquery)

    <script type="text/javascript">
                    function disableEnterKey(e) {
                        var key;
                        if (window.event)
                            key = window.event.keyCode; 
                        else
                            key = e.which; 

                        if (key == 13)
                            return false;
                    }

                    $(function () {
                        document.onkeypress = disableEnterKey;
                    });

   </script>

My apologies if I'm rehashing something you've already thoroughly eliminated. I just know I've gone through a similar process and ended up back at a javascript solution.

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