Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

stop the keyboard from hiding

I'm trying to do a webview html page interface to a chat server (phpfreechat). works fine so far technically - except, after every sent message, the keyboard disappears, and the user has to click on the text field to bring it up again.
(and yes, unfortunately, it all has to take place in the one webview window…)

So I'm trying to figure out how another site (donutchat.com) has setup their chat page. if viewed in iphone's safari, you get a nice chat window, and a single text field with a send button. When the user clicks the text field, the keyboard pops up, and you can type your message. BUT - here's the difference - when you hit enter, or "SEND", action occurs on the page, and the keyboard STAYS IN PLACE. (and it doesn't look like there's a page reload)

So how can you force that kind of functionality from the keyboard, and put it into an html form, or using an embedded script?

My web searches have turned up empty, so I'm looking to all your combined expertise!


— asked May 5th 2010 by david hoare
  • hide
  • keyboard

2 Answers

  • Why don't you take a look at the source of donutchat?
    You can change a browser's user-agent to iphone and see what is there.

    I think they are using a javascript and when they are sending the form the somehow keep the focus to the input tag. Maybe the send button is not even a "submit" type, but they are doing it using ajax, so you could to….

    — answered May 5th 2010 by Dan Tamas
  • thanks - - yep: I ended up taking the textbox out of the 'form' (to stop page reloading on submit) then using the onchange action to focus back on the textbox immediately and clear it, then do the actions I wanted… seemed to work great.

    — answered May 10th 2010 by david hoare
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.