3

As most of us phonegap users already know by now, there's a way to remove the form assistant (prev, next, done) bar from uiwebview. It has been asked several times on stackoverflow, here are some examples:

How do I install this script into PhoneGap for iOS

Phonegap: completely removing the black bar from the iPhone keyboard

Remove form assistant from keyboard in iPhone standalone web app

This applies to all textfields in all files of one's phonegap app. What has not been discussed, however, is whether this somewhat hacky solution can be applied to one or several textfields only, or on specific html-pages inside one's phonegap application.

Since phonegap users can't target html textfields with "native" C code, I assume the first simply can't be done (I would love to be proven wrong here though.) But perhaps, it might be possible to remove the form assistant bar from specific html documents by using the above mentioned solutions and targeting specific html files. If so, how do i do this?

Community
  • 1
  • 1
Jonathan
  • 2,953
  • 3
  • 26
  • 37

1 Answers1

1

I finally found a solution that does this sort of perfectly. The only problem is that when the keyboard deploys, the canvas jumps a little as a consequence of the bar being remove. This is how's it's done:

Download this plugin from GitHub

HTML

Include the Javascript after cordova.js and before your application's javascript file

<script type="text/javascript" src="keyboard_toolbar_remover.js"></script>

In your Javascript, include the module

var toolbar = cordova.require('cordova/plugin/keyboard_toolbar_remover');

To disable the toolbar

toolbar.hide()

To re-enable the toolbar

toolbar.show()

Installation

Copy KeyboardToolbarRemover.h and KeyboardToolbarRemover.m to the Plugins directory of your iOS project.

Copy keyboard_toolbar_remover.js to the www directory of your project.

Edit Cordova.plist. Add an entry under the plugin section mapping KeyboardToolbarRemover to KeyboardToolbarRemover as shown below:

Add plugin entry

Jonathan
  • 2,953
  • 3
  • 26
  • 37