facebook

no onback event when keyboard active

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #352010 Reply

    mobio9471
    Member

    Hi,

    I layout and position an input field by javascript and css.

    When I touch the input field a keyboard opens and the onclick – event is fired that does changing the layout and position of the input field for me.

    If I now touch the back button the keyboard is closed but NO onback-event is fired.
    If the back-button is touched a second time after the keyboard is closed the onback-event is fired and changes layout and position as expected

    But I need a mechanism to fire the onback event that changes layout and position of the input field if the back-button is touched the FIRST time.

    How can I achieve this ?

    On the internet someone suggested to add
    android: windowSoftInputMode = “adjustPan”
    to the Manifest.xml file. That should solve the problem.

    How can I change the androidmanifest.xml file using mobione ? Is this possible ?

    Or does there exist any other approach to solve the problem ?

    Please help me 🙂

    #352052 Reply

    Hi,

    Well, off the top of my head, as you seem to be implementing a lot of custom code (and without me seeing it), if possible I would try coding your back button as well. If this is the button widget you can use the run javascript on click action.
    Using: $(‘#yourElement’).blur(); should hide the keyboard, then you should be able to follow that with your history.back() call or a direct call to your screen, depending on your preference.

    If this does not work let me know and Ill investigate a bit more.

    #352068 Reply

    mobio9471
    Member

    Thank you very much for your reply brandon,

    I need to use the device back button. To get an intuitive look and feel of my app. So I want to avoid creating my own back button using the button widget.

    If no keyboard is visible, the back-button works as expected and fires an onback event each time being touched.

    But if the keyboard is active, it closes it at the first touch without to fire the onback event and at the next touch (without keyboard) it fires the onback event as expected.

    How can I convince the device back button to close the keyboard and to fire the onback event or any event else at the same touch. After the keyboard closed I need to perform javascript action without user activity.

    What about the Manifest.xml file entry? Can I do that with mobione ?

    Any help would be very apreciated !

    #352108 Reply

    Hi,

    The manifest file is not editable in Mobione. You could actually grab the Cordova/Phonegap API and intercept the back button: http://docs.phonegap.com/en/2.9.0/cordova_events_events.md.html#backbutton

    Something like:

    document.addEventListener(“backbutton”, onBackKeyDown, false);

    function onBackKeyDown() {
    // Handle the back button
    //Your Override code to hide the keyboard, maybe: $(‘#your_textboxID’).blur();
    alert(‘Back button pressed’); //show you have overridden the back button
    }

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: no onback event when keyboard active

You must be logged in to post in the forum log in