cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the value state of Select control?

Former Member
0 Kudos

Hi,

My requirement is to set the value state of the select control to Error or None based on certain conditions. The problem is that since select inherits from control and not from inputBase, it does not have that property.

Is there any other alternative to achieve this result?.

Thanks & Regards

Deepshikha

Accepted Solutions (0)

Answers (1)

Answers (1)

DK007
Active Participant
0 Kudos

Hi,

Yes, you can do it through style sheet.

Here is the logic you can try:

var selObject = get the select control.

if(value is blank or empty) {

  selObject.removeStyleClass("selectNormalValueState");

  selObject.addStyleClass("selectErrorValueState");

} else {

  selObject.removeStyleClass("selectErrorValueState");

  selObject.addStyleClass("selectNormalValueState");

}

Below is CSS:

.selectErrorValueState{

      border-width: 2px;

      border-style: Solid;

      border-color:  #CC0000;

      background-color: #FFDDD9;

      padding: 0 0.6875rem;     

}

.selectNormalValueState{

    color: #000000;

    background-color: #ffffff;

    border: 1px solid #c0c0c0;   

}

Hope this might help.

Thanks,

Dheeram