Skip to Content
avatar image
Former Member

sap.m.Input - How to catch onFocus-Event

Hi,

i am new at sapui5 and i try to create my first mobile app.

Is there any way to catch the onfocus-event on an sap.m.Input-element?

Can´t find any method to do this in API-DOC and Google told me to create a custom-component?!?!?!?😕

Realy? 🤯

In Chrome inspector my Input-element looks like this:

<div id="id_text" data-sap-ui="id_text" style="width:100%" class="sapMInput sapMInputBase sapMInputBaseCursor">
     <input id="id_text-inner" value="TEST_VALUE" type="text" class="sapMInputBaseInner">
</div>

Maybe there is a smart way to add the onfocus eventhandler to the "id-inner" inputfield?

Some ideas?

Thank you

Sascha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 05, 2015 at 03:52 PM

    You can attach to native and SAP-specific events using the addEventDelegate method of any control. Here's an example: http://jsbin.com/vuqokisimu/2/edit?html,js,output

    - Max

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 06, 2015 at 04:41 AM

    Or you can extend the sap.m.Input control to fire focus event.

    Example

    -D

    Add comment
    10|10000 characters needed characters exceeded