Is there a way to prevent the on-screen keyboard from popping up by default when a HTML text input field gets focus on a windows 8 touch screen pc?
The application in question is a barcode/rfid scanning web application.
It would be preferable if the user could also still pop up the on-screen keyboard manually if they need it.
Preferably a solution which avoids changing the global settings of the machine.
More Info: The text input field needs to be able to receive focus and accept keyboard input from the bar-code and rfid scanners attached to the terminal.
Try
$("#textbox1").attr("readonly", "readonly");
or
$("#state").attr("readonly", true);
Thanks
AB
Related
is there any way to set focus on the input field without showing keyboard on a device? The code is shared across the website and the mobile device. I just want to acquire situation when on a website I got "focus" on the input element as well as on device but without displaying a keyboard on the device. I tried:
document.getElementById("myInput").focus();
but doesn't work.
Why do you want to focus an input field if you don't want to write in it? Otherwise you can check with
var isMobile = Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
if the user agent is mobil before you take the focus.
It's a normal behavior of device.
You can use some cordova plugin (like this cordova-plugin-keyboard) to hide the keyboard.
Don't forget to check out if the user agent is from a mobile device
Anyway, it's the behavior of device, hide the keyboard will make your application act different from the others
Is there a way to automatically scroll down on a webpage, when a certain input field becomes hidden due to Android keyboard on Chrome for Android? I know how to scroll a webpage using JavaScript, but has someone tried to do it for this specific purpose?
I have been working on this specific requirement for more than 2 months now. But I haven't found a solution yet to disable the native keyboard when an input field is focused in a webview. I am building an app which has a built in keypad(essentially a view) and I want this to be displayed instead of the native keyboard.
What I've tried so far:
Add javascript eventListener for click events to display my keypad
using JavscriptInterface.(Works)
Set the webview focusable:false and
its parent's descendantFocusability to blocksDescendants (This works
but doesn't display the cursor on the input field)
Hiding the native
keyboard on resize event of javascript using loadUrl method.(Works
but the native keyboard is displayed momentarily before hiding the
keyboard)
Listening to the OnGlobalLayoutChange event to check if
the keyboard has been added. (Works but the result is same as
in the case above with a little improve in performance)
Force stop the IME service. (Works but the app has to be a system
app to force stop packages and the keyboard service has to be started
whenever the app goes to background.
Is there a way in which I can make this work?
You should set the windowSoftInputMode to stateAlwaysHidden for the Activity containing the web view. This should keep the onscreen keyboard hidden for the entirety of that Activity.
Is it possible to popup virtual keyboard when some command is being received from server? I am trying to call focus on text area but soft keyboard is not coming. I agree that for keyboard to popup, user event is required. Is there any way to show virtual keyboard forcefully? I am talking about web app inside Android chrome browser.
You can do this by calling focus() then click() on the input, but, as you say, only when the script is initiated by user input. My current answer, having spent a day fiddling, is that there is no way to get around this.
This question may help you: Showing Android's soft keyboard when a field is .focus()'d using javascript
In your case you could try to have a hidden text input field on your page and trigger a click event on it when the command is received from the server.
EditText editText = (EditText) findViewById(R.id.myEdit);
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
// only will trigger it if no physical keyboard is open
mgr.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
May this will help you
I'm trying to build an application where if the user activates a page, a focus event will occur and focus into a text field. I was half-heartedly expecting that when I called .focus() on in the input box, Windows 8 would pop-up the on-screen keyboard. This in not the case.
Does anyone know of a way to get the Windows 8 on-screen keyboard to come up when the text field is focused via javascript.
If the user "taps" into the textfield, the focus event does fire and the keyboard comes up.
I've tried binding to touchstart, 'touchend, click and focus, but all of these do not seem to activate the on-screen keyboard.
This application will run strictly on Windows 8, so there is no need to make it so that other platforms that do not have built-in on-screen keyboards work properly.
You can't. Only user actions can open the on-screen keyboard. This is by design. See here.