OpenUI5 Disable/Enable input

6k Views Asked by At

I am using OpenUI5 and I want to disable an input field. I've already tried the following, but it is not working:

sap.ui.getCore().byId("xxx").setDisabled(true)
2

There are 2 best solutions below

0
On

The input control does not have a 'disabled' property so the setter setDisabled will not work. However it does have a enabled property so you could use the setEnabled method.

sap.ui.getCore().byId("xxx").setEnabled(false); //Disables the control
0
On

If you want to prevent the user from editing the Input value, you should set it's editable property to false using the Input's method setEditable(false).