Reputation: 1342
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.
Upvotes: 0
Views: 674
Reputation: 7313
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.
Upvotes: 1
Reputation: 2101
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
Upvotes: 1