Setting a field to disabled makes the HTML-input read-only and not greyed out

Niklas6
Tera Expert

I have created a record producer in a scoped app with some variables, both select and text input fields. In an onLoad catalog client script I am setting a few of those fields, both text and select, to disabled (i.e. setDisabled(<field>, true)). 

 

The select fields are disabled and greyed out but the text fields are not greyed out but you can't write anything. Inspecting the HTML-code I can see that the select input has gotten the attribute disabled while the text fields gets readonly="readonly". As I understand setting the field to readonly makes it readonly but not greyed out and disabling it makes it greyed out as I want. 

 

When testing to create a catalog ui policy instead (and disabling the catalog client script code) the result is the same. 

 

There is no other place where I set disabled or readonly. 

 

Anyone having any clue how to fix this?

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Niklas6 

why to use setDisabled() and not use setReadOnly?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Because I want the field greyed out and I think setReadOnly doesn't provide that but setDisabled does. Right?