cancel
Showing results for 
Search instead for 
Did you mean: 

Select value of Input control upon mouse click

arun_k7
Explorer
0 Kudos

I'm extending a standard fiori list application and there is an input field( Input Contol) whose value is mapped to OData coming from backend. My requirement is to select(highlight) the value of this input field upon mouse click so that its easier for users to input a new numeric value( requirement.jpg) in all devices. How to achieve this considering that this is a Fiori extension.

Accepted Solutions (0)

Answers (1)

Answers (1)

arun_k7
Explorer
0 Kudos

Hi,

I managed to get this requirement done by placing the below code in onInit in my controller. However, I dont know whether there is any better approach.

		onInit: function() {
			// To select value of Input field on mouse click
			window.sap.m.Input.prototype.onfocusin = function(e) {
				this.$().addClass("sapMInputFocused");
				document.getElementById(e.target.id).setAttribute("onclick",
					"this.select()");
			};
		},