7

We have an HTML app that collects transaction data (picks, putaways, replenship, etc.) in a distribution center. We'd like to use an Intermec CK71 with WinMobile 6.5 and a browser as the data collection device. At present our users scan / key into data entry fields and then click the NEXT button to enter data on the server.

Is there a way to use JavaScript to enable a hard key (ENTER) to emulate the cursor tap on the NEXT button? We can get the CK71's scan code for the ENTER key by using Intermec's on board key board remapping utility.

Any help would be greatly appreciated.

Thanks

WiFiGuy
  • 71
  • 1
  • 2

2 Answers2

2

Make the "Next" button a button of type="submit" so that the onsubmit on the form triggers.

Pressing enter is then the same as 'clicking' the button, it will also cause the onsubmit to fire.

This also requires you to have a <form> surrounding the button. You can have buttons without a form I would argue that is bad design.

If this solution works for you rejoice because you don't need to get into any JavaScript nastiness.

Halcyon
  • 57,230
  • 10
  • 89
  • 128
1

What you would have to do is add an event listener for the keyboard, like this

element.addEventListener("keydown", keyfield, false);

and then set a function to get the key down

function keyfield (e) {
    var keyCode = e.keyCode;
}

Get the key code for the enter key (13)

and do

function keyfield (e) {
    var keyCode = e.keyCode;
    if(keycode==13){
    form.submit(); //or button.click()
     }
}
scrblnrd3
  • 7,228
  • 9
  • 33
  • 64