KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been searching far and long, and to this moment, I did not come across a working solution for PhoneGap / Cordova applications that would show soft keyboard programmatically. Scenario: We have a PhoneGap application - a website created in jQuery Mobile - that at one point shows a dialog to the user. This dialog is also a web page and has one single INPUT text box where user should enter a code. Problem: When the code dialog is shown, the input box is focused using JavaScript . However, due to restrictions placed on iPhone's internal browser, the soft keyboard does not come up until the user actually really clicks inside the input text box. What we tried: creating a hidden text box and making it first responder making the actual webview a first responder once the input receives focus via JavaScript using sendActionsForControlEvents to try and delive Touch events to the webview (although if anyone has a working code for a PhoneGap application, I would appreciate if they could share it, since I'm no professional in iOS coding) Any ideas? EDIT: The restriction mentioned in this question is for built-in browsers only... if you're aiming Opera, you will be successful by using the following code: var e = jQuery.Event("keydown", { keyCode: 37 }); $('#element').focus().trigger(e); EDIT2: This is a final working PhoneGap code that can be used in a plugin: keyboardhelper.h // // keyboardHelper.h // soft keyboard displaying plugin for PhoneGap // // Copyright 2
Tags (comma-separated)
Save Edits
Cancel