Show Keyboard dynamically in ionic - android

I am trying to display keyboard in ionic dynamically with no luck. I have a text field like
<input type="search" placeholder="Search" ng-change="onSearchChange()" ng-click="clicked()" ng-model="searchVal" id="MyField" ng-controller="searchCtrl" >
in clicked function i am navigation to new page like
$state.go("tabs.searchresult");
but there is no keyboard on next page. I want to show keyboard on searchresult.

#nOmi: As my understanding.
You are in the search page has a search box with id = MyField, then you type a keyword. After touch to tap icon or tap enter, it will go to search result page.
In search result page, it also have an input with id = MyField in the top with result below. And you also want to show the keyboard.
If it is, please do so.
$state.go('tabs.searchresult').then(function() {
$('#MyField').focus();//YOU WILL NEED JQUERY FOR THAT ONE.
});
If in the search result page doesn't have any text box. You need to install ionic keyboard plugin to trigger show keyboard dynamically.
The script will be
$state.go('tabs.searchresult').then(function() {
cordova.plugins.Keyboard.show();
});

Related

How to change IME Action dynamically in android for webkit

When I tap on input[type=number] element in HTML page (Note: html page has only one input element), the keyboard appear with "NEXT" button.
How can I change this NEXT button to DONE/OK or hide it in android 2.3, is it possible to change/hide it?
you can change the ime options by using below code:
input type="text" style="-ms-image-mode: active; ime-mode: active;
Hope it will help. Thanks

html phonegap android : numeric soft keyboard has next instead of go button

This is driving me crazy and I can't find the answer anywhere.
I have forms in my phonegap app. If the input type="text", the text keyboard pops up and "go" is displayed in the corner. When you click go, it submits the form. That all works as I would expect. But if I use input type="number", the number keyboard pops up and "next" is displayed in the corner. When you click next, if there is another input box before the button tag, it goes to that input. That's okay. . . not ideal, but makes sense. But if it is the last input field on the page, click "next" does nothing. It doesn't put focus on the button (even with tabindex) and it doesn't submit the form (ideal).
I'm using phonegap 1.3.0 and jquery 1.7 if any of that helps.
You can detect the next keyboard press by using the following bind in JQuery:
$('input').on('keydown', function(e){
if(e.which === 9) {
//your code here
}
});
The 'next' button emulates the tab keypress event on a keyboard, which is key code 9. Unfortunately, keypress and keyup events do not detect the next key event, so you need to bind it on keydown.
Hope that helps!
Okay, now I do have something that looks like an answer and quacks like an answer.
It's a horrible hack, and I am experiencing some side-effects at this point, but it's a small leap for mankind anyway.
Add an invisible text input to your form, which automatically submits the form as soon as it receives focus. Since it can only receive focus from the user pressing 'Next' or tabbing from the last number field, there should be a pretty solid logic in the user sequence.
<input type='text' style="opacity:0;" onfocus="javascript:$('#thisForm').submit();">
The side effects are:
the hidden form field will briefly be visible. You can avoid this by
using the onfocus handler to also re-focus on the number field that
was just left. Or you can set the width of the input to 0. The latter works best for me.
if you're using jQueryMobile like me, you're inviting horrible page transition ugliness on yourself, so if your form is in a dialog and submitting the form closes the dialog, be sure to set the dialog transition (when it is being opened from a previous screen) to 'none'.

Android: Showing keypad at scrolling of page

How to show the keypad even when the page is being scrolled up in android to fill text in textfield. Following is my problem scenario:
I have 1 login page:
1) I tap on "Username" field.
2) Keypad opens up.
3) Now scroll up login page.
Issue : Keypad got closed when we scroll up login page.
But I want it should not get hidden
How to solve this issue.
Thanks
If your keypad doesn't automatically pop up, you can call it by long-pressing the menu button in any app or web setting. This should work for any device running Android.

How do I customize imeoptions for text boxes of web form developed for Android

I have a webform that is integrated into a native app via a webview. But now when the user sets the focus on the first textbox of the form, I see a Go button on the soft keyboard. Instead, I'd like to have Next button, clicking on which would take me to the next input control. And the last input control alone should have Go button on keyboard. How do I achieve this? (Note: Please note that I want this on a web form. I've already found material on how to do this on a native form.)
Please go to take a look, is that what you are looking for?
How to change the Android softkey keyboard "Go" button to "Next"

Auto complete text remaining on screen

Does anyone know why the search text remains on the bottom of screen (as shown in image below). Steps to get there:
Choose to search for location
qwerty keyboard comes up
auto complete bar appears above qwerty
hit "Done" and the auto complete text remains on screen and relocates to bottom, but search is called
. This does not happen all the time.
With KeyEvent.ACTION_UP the search text "sticks" to screen when clicking "Done" ... goes directly to search
With KeyEvent.ACTION_MULTIPLE, "Done" closes the qwerty and user must click search button to begin search
If you want any word, I think the keyboard do that with predictive text. If only want a list of items ( only countries ) you should use a Spinner.

Categories

Resources