Setting a field to disabled makes the HTML-input read-only and not greyed out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 03:42 AM - edited 11-24-2023 03:59 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 03:52 AM
why to use setDisabled() and not use setReadOnly?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 03:54 AM
Because I want the field greyed out and I think setReadOnly doesn't provide that but setDisabled does. Right?