NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on August 09, 2020, 04:18:40 AM
-
Nt web server using chrome in Android.
Im using a barcode scanner, then validate the code and show a message.
The keyboard appears when the codebar entry field is selected. see pic
Then the user cant see the result of the scan.
How to get rid of the mobile keyboard?
Thanks
-
https://stackoverflow.com/questions/41979445/javascript-hide-mobile-default-keyboard-but-keep-input-field-active
Looks unpleasant
-
Thanks bshield,
How do you think about this:
Define an Input element above and append CSS property which will hide the soft keyboard to popping up.
Set Focus to make ready for scanner input in the text field.
The last Step Turn Read-only mode off to input data.
yourInputVal = document.getElementById('myInputElement');
yourInputVal.readOnly = true;
yourInputVal.focus();
setTimeout(function(){
document.getElementById('myInputElement').readOnly = false;
},
How to test it with NT?
-
How if I keep the entry field read-only=true and turn it to false when it gets focus?
How to detect it has focus?
-
No way, cant do it...
Any hint?
-
Ive made it!
Using this function instead of the Select, I set the field readonly, set focus on it (a readonly field does not activate the keyboard), wait a while for the focus and set it not read only.
I works!
This is the function:
function hideKeyboard(element) {
element.attr('readonly', 'readonly');
element.focus();
setTimeout(function() {
element.focus();
element.removeAttr('readonly');
}, 100);
}
And this is how I call it:
p_web.Script('hideKeyboard($("#loc__CodigoEnvio"))')
where loc__CodigoEnvio is my entry field id
Hope it helps someone.