3

If I were writing a native app I would try the solution given here which says:

"Try to implement the following method in text view's delegate:"

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    return NO;
}

Unfortunately I need to use phonegap, so I don't have a text view to manipulate. It would be great if I could permanently suppress the keyboard in this app. We've got some custom on screen keyboard that people are supposed to use instead. So, any idea how to disable the popup keyboard completely?

Community
  • 1
  • 1
lashleigh
  • 2,555
  • 2
  • 20
  • 28
  • so you don't have anything that calls it ? what calls the keyboard to show? – Neil Jun 07 '12 at 00:55
  • The keyboard pops up automatically whenever an input or textarea gets focus. This is not something I have set explicitly, it seems to be the default behavior. – lashleigh Jun 07 '12 at 05:44

1 Answers1

4

Just put a transparent div over the input field, so the the click will be on that div and not on the input field. Now you can activate your own keyboard by click and fill in the characters with javascript.

  • Update:

The following solution works:

The keyboard is directly linked to the focus on the input field. when you use readonly="true", you can get the click event and then you should be able to chamge the value. in jQuery something like this: $('myinputfield').click(function(){$(this).val(newinput);});

hm.
  • 166
  • 9
  • Hmm, may be it focusses automatically. In case it does that, you may take the focus off the input field. When you put the focus on a button, the screen should not display. However, I do not know if the keyboard would show up for a blink of an eye. This is something to try. I would investigate into the jQuery functions .blur() and .focus(). Also it might be important when you call the function. On document load or before might make a difference. I did not try this out, but this is how I would approach this issue. You also may try to add readonly="true" to the input element. – hm. Jun 07 '12 at 20:36
  • The issue is that the user still needs to be able to interact with the textarea, as soon as they touch it the keyboard pops back up again. I need, as I said in the title, a way to completely disable the keyboard. – lashleigh Jun 07 '12 at 20:40
  • The keyboard is directly linked to the focus on the input field. when you use readonly="true", you can get the click event and then you should be able to chamge the value. in jQuery something like this: $('myinputfield').click(function(){$(this).val(newinput);}); – hm. Jun 07 '12 at 20:54
  • Now that is interesting, I had not thought of the readonly attribute, and it appears to work great. You should make this your answer above. – lashleigh Jun 07 '12 at 20:57