Add scroll bar on Multi Line Text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 09:46 PM
Hi.
I am looking for the way to fix height of Multi Line Text in catalog item.
Best plan is show scroll bar when over the limit.
At least i make Multi Line Text stop expanding.
Thank you for help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 10:42 PM
Hi @Jaeik Lee ,
ServiceNow will auto-expand all textarea until the height reaches 435px as defined in the CSS.
The auto-expand behavior is on the "input" event handler.
Not sure if it's the right way, but I made a simple UI script to change max-height, like the following:
EDIT: I missed the second parameter in the insertRule() function in the screenshot, without the second parameter, it won't work in some browsers, e.g. Firefox.
document.styleSheets[0].insertRule("HTML[data-doctype=true] textarea { max-height: 100px !important; }", 0);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 10:52 PM
Already tried that. but it didn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 10:57 PM
@Jaeik Lee use max_length attribute to limit the length.
Adding scroll bar using client script may or may not be possible, if possible it will be a DOM which is not recommended by servicenow. The max_length attribute will restrict it from expanding
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 11:02 PM
Applicable variables: Single-line text, Wide single-line text
I think it doesn't work