Closed bizcad closed 11 years ago
I still haven't found a good solution. So far the only thing I've found that might work is using phonegap and adding some java (not javascript) to make it work. Sadly, I won't be able to do anything until I get back from my sabbatical.
Ok, I finally got my hands on an Android tablet, and I think I found a solution... but there's a catch.
You can either just set the readonly attribute of the input to prevent the default keyboard from opening, BUT if you have an attached or wireless keyboard, it won't work.
<input type="text" readonly="readonly">
Or, you can set the lockInput
option to true
... in this example I ended up detecting the userAgent string to determine if the user is on an android, iPad, or iPhone. It's not the best solution, but it should work for now.
$(function(){
$('#keyboard').keyboard({
lockInput : navigator.userAgent.toLowerCase().search(/ipad|iphone|android/i) > -1
});
});
I think I'm going to add a new keyboard key that allows you to switch the readonly attribute. That way the user has control of when to lock or unlock the manual keyboard input... but I'm sure the build-in keyboard will pop up in that case =(.
Great news. I will give it a try. I do not know why I did not think of the readonly before. That was a headslap moment for me. The whole point of my app is to use the tablet without a kb/mouse so there is no catch for me. I do not need to worry about the user agent string because I have control over the device.
As an interim solution I downloaded Perfect Keyboard Free from the Android App store and was able to set the input to the keypad in their settings. I just needed to get the page (it is a Single Page App) into some tester's hands. The Mottie KB is better because I can add calculator functions into the javascript.
Ultimately, I thought I could make an android app that has the Web Page part as it's only activity. The web page would go to my regular web site. I think this is more or less what phonegap does. Then I could write some functionality that would post from the javascript to the app to set the KB off.
All in all, I am very pleased and surprised at your responsiveness. I cannot thank you enough for paying this much attention to me.
Nick Stein aka bizcad
Hi @Mottie , I am unable to suppress the native keyboard on iPad, I have tried with lockInput:true
, but it doesn't work. I tested the demo you shared "http://jsbin.com/eniQaBO/3/" on my iPad but the native keyboard also appears along with the mottie keyboard.
I also tried with readonly="readonly"
and hacked the reveal() method by commenting these lines
/*if (base.$el.is(':disabled') || (base.$el.attr('readonly') &&
!base.$el.hasClass(kbcss.locked))) {
base.$el.addClass(kbcss.noKeyboard);
return;
} else {
base.$el.removeClass(kbcss.noKeyboard);
}*/
this works for the first time but as we start pressing the keyboard buttons, the iPad keyboard appears from nowhere. Can you please look into it? Tested on iPad 2 (ios v8.3)
When applying Mottie Keyboard to a mobile device, on Android at least, a click on the text input brings up the Mottie Keyboard, but also the Android keyboard. I want to not show the android keyboard. I have tried the blur hack as discussed here but it does not work.
Following is my ko.bindingHandler init where the keyboard is bound to the text element. I am trying to just show a number pad so I filter viewModel items not decimal or integer.