cancel
Showing results for 
Search instead for 
Did you mean: 

how to set focus textbox in sapui5

Former Member
0 Kudos

I need to know how to autofocus textbox by loading the page

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

What if I need to set focus to a popover that is in a separate fragment, which gets opened on clicking at a button in my UI ?

smithshah
Explorer
0 Kudos

Hi Puneet,

Did you get an answer to your query?

I have a similar use case so the solution would be of great help to me

0 Kudos

Hi Smith Rajeshkumar,
I used the same -
jQuery.sap.delayedCall function with delay parameter as 0 instead of 500
This function can be called after the statement loading the fragment in the controller part

Former Member
0 Kudos

Hi,

instead of onInit, write the function in "onBeforeRendering",

try this:

onBeforeRendering: function() {

jQuery.sap.delayedCall(500, this, function() { sap.ui.getView().byId("asd").focus(); }); }

sagarikagattu
Participant
0 Kudos

Hello ,

Use the below code, if you have designed the page in javascript

jQuery.sap.delayedCall(500, this, function() {

sap.ui.getCore().byId("name").focus();

});

If the you have used XML view, write the below code in init function of the respective control.

jQuery.sap.delayedCall(500, this, function() {

this.getView().byId("name").focus();

});

Former Member
0 Kudos

but it not fire when form load focusing last wizard step.

how can I resolve it

Former Member
0 Kudos

onInit: function() {

jQuery.sap.delayedCall(500, this, function() { sap.ui.getView().byId("asd").focus(); }); }