Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Select text on focus

Hi guys,

I have a TextField where I would like to select the whole text programmatically. For example when the TextField gets the focus.

    var oTextField = new sap.ui.commons.TextField("tf_id", {value: "Test"});

oTextField.onfocusin = oController.onFocus;

onFocus: function(oEvent)


        var otextField = sap.ui.getCore().byId("tf_id");




Can anyone explain me how I can do this in a SAPUI5 way? And if this is not possible how I can do this in another way?

Thanks a lot


Former Member
Former Member replied
Not what you were looking for? View more on this topic or Ask a question