Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Add border-color through controller in sap ui5

0 Kudos

How can i add border color to an input box through Controller when i click on a button .

instead of writing in css file can anyone suggest me how to write in controller.js so that when i click a button the border color has to be changed to red .

1 REPLY 1

BharathM
Participant
0 Kudos
<!--in view-->
<Input id="idInput" change="setState"/>


//in controller
setState: function(){
let inst = this.getView().byId("idInput");
inst.setValueState("Error");

//or

inst.addStyleClass("cls1");
}

//in css file
.cls1{
border-color: red;
}

You can use any of the ways to alter the appetence of the control, For more you can visit SDK for control specific options.

Thanks,

Bharath.