Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add scroll bar on Multi Line Text

Jaeik Lee
Mega Sage

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. 

6 REPLIES 6

Community Alums
Not applicable

Hi @Jaeik Lee ,

 

ServiceNow will auto-expand all textarea until the height reaches 435px as defined in the CSS.



SandeepDutta_0-1673505700462.png

 



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);


 

SandeepDutta_1-1673505700485.png

 

 

Jaeik Lee
Mega Sage

Already tried that. but it didn't work.

@Jaeik Lee use max_length attribute to limit the length.

 

Refer: https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/product/service-catalog-management... 

 

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
LinkedIn

Applicable variables: Single-line text, Wide single-line text

I think it doesn't work