Hi All.
Most Android Apps have a [GO] key on the pop up keyboard that hides the keyboard and enters what was typed. The only way I find to hide the keyboard is by tapping an empty area on the screen or another field. I am getting a bit of flak regarding this. Can you point me in the right direction on how to implement the app similarly to what I described above as the norm?
Earlier, I had the need to disable the android ‘Back’ button and implemented a function in the Global Code tab. Currently I have modified the function to use the android back key to close the soft keyboard. It works, but not exactly what I needed:
JavaScript
document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown(event) {
event.preventDefault();
if($("#myModal").hasClass("in")) {
$("#myModal").modal("hide");
}
}
End JavaScript
Yes, it looks like the [GO] key is the enter key. Since some text areas accept [Enter] during input as a new line (vbCrLf); it would be better to intercept another key (The right Arrow would be perfect) as a way to close the soft Keyboard. How do you go about getting the names for the event.key variable? Is the right arrow simply “Tab”?
If you are running your app on a PC you can use Function window_onkeydown(e). This works on Android as well but there are no tab or arrow keys on the on-screen keyboard :
Function window_onkeydown(e)
If keycapture = "off" Then Exit Function
keyval = e.keyCode
alert("keyval: " & keyval)
If keyval = 9 Then 'Tab was pressed
alert("tab was pressed")
End If
End Function
but blur() doesn’t work.
I’ve put that Code into the sample …\bootstrap\input.nsx
Function Input2_onkeypress(event)
If event.key = "Enter" Then Input2.blur()
End Function
Function Input3_onkeypress(event)
If event.key = "Enter" Then Input2.focus()
End Function
No reaction with blur(), focus() works fine.
Also tried it with sample …\NSB.InputBox.nsx
I had a look at your code. The topic was how to get rid off the “soft”-keyboard after pressing “go” at your android. is there any help with johnC’s code?