cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member

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

Accepted Solutions (1)

Accepted Solutions (1)

maximilian_lenkeit
Participant
0 Kudos

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

Answers (1)

Answers (1)

former_member182862
Active Contributor
0 Kudos

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

Example

-D