Edit HTML element on a single multi-line text box

mattystern
Kilo Sage

Hello!

I am currently creating a website form for our business on our service portal for Website change requests, upgrade requests and for when something is broken.

One of the requirements was to show some help text if the selection was on "Something is Broken." I have done this with a Catalog UI policy and a multi-line text box which is set to "view only" 

In the self-service and with the "Try it" buttons on our developer instance, this works fine. However, on our Service Portal (instance.service-now.com/sp), the text box doesn't expand to show the entire text and instead adds a scrollbar (see "Current State") 

Where can I edit this to change the box to be 115px in height when it appears? I was able to make it work when editing the elements in the F12 console, but do not know where this is editable from SNOW (see "Desired State")

Current State:

 find_real_file.png

Desired State:

 find_real_file.png

1 ACCEPTED SOLUTION

This code was not doing it for me, unfortunately. I tried changing from onLoad to onChange, added the "sp_formfield_IO:" to it and nothing would expand the box 😞

I ended up changing my field from a text box to a label with help text and added some <br> tags in to space out my message and it ended up turning out pretty nice. 

 

Thanks for all of the help Pedro! 

View solution in original post

6 REPLIES 6

Pedro Lopez
Kilo Guru

Hi Matt,

Can you share the HTML code, please? Basically, by adding the height in the style should work. But I just want to see how you are getting the HTML element.

 

Regards,

Pedro Lopez

Hi Pedro,

Here's where I changed it in the HTML console (F12 menu in chrome) to get the screenshot above. I don't know where it lives in servicenow though, so it will revert back if I leave the page.

find_real_file.png

Hi Matt,

You can do it from an Script. If you see, the <textarea> has an ID, please copy it and use this code:

 

document.getElementById(ID HERE).style.height = '114px';

 

Hope this helps,

Pedro Lopez

Hi Pedro,

I have entered this as a catalog script on the "Website Change Request" catalog. I tried onLoad and onChange and neither are doing the desired result. Is this the correct place to put the script?

find_real_file.png