Currently, I am using HTML, js with phonegap to write an Android application. This is the function I use to catch the enter button on the virtual keyboard:
function handleFormKeypress(e)
{
var currentInputElement = $(e.target);
if(e.keyCode == 13 || e.keyCode == 10)
{
Log("handleFormKeypress - Go pressed")
//this needs to be checks as passing in the 'submitButton' is optional
if (e.data != undefined)
{
if (e.data.handler != undefined)
{
e.data.handler();
}
}
currentInputElement.blur();
e.stopImmediatePropagation();
return false;
}
}
As you can see, I catch the keycode of the keyboard. Converting to Android app using Phonegap, it should catch the Go button, or the Next button of the Virtual keyboard.
My input field's type is number:
<input type="number" id="blah blah blah"/>
In this situation, the android virtual keyboard display an numberic keyboard with the next button.
I tested on several Android phones. When I click to the next button, it jump to the next page as I expected. But on some HTC phones, in fact, the HTC Nexus One and the HTC One X, it does nothing.
Anybody has some ideas here?
Thanks in advance.