Set Rich Text Value in client script

Peter Xiang
Tera Expert

Hi Everyone,

I want to use client script to modify the rich text value in the Rich Text lanel type. Does anyone know how to implement it?

find_real_file.png

19 REPLIES 19

H_kon Sm_rvik
Kilo Expert

This is probably not an issue anymore, but you can use the g_form.setLabelOf('<field>','<value>') to achieve what you want to do.

Hi,

Can you are more about this and demonstrate how you have this working for a rich text label as mentioned in the author's question. I don't believe this actually works and I wanted to double-check since you're saying it is and replying with this on a few different posts.

Thanks!

Please mark reply as Helpful, if applicable.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Sure! I've created a simple catalog item with 2 variables and a onChange catalog client script for this purpose. This is created on a new Rome instance I spun up an hour ago.

 

find_real_file.png

sImg URL is an empty input field and the Rich text label contains some dummy text.

The client script reacts to changes to the img url field and changes the label of the rich text label to print the img url and the image within a blue border.

find_real_file.png

Here's the form in Service Portal before anything has been input

find_real_file.png

Here's the form after i pasted a link to an image of my birthday dog

find_real_file.png

 

This method will work in Service Portal but not classic Service Catalog UI.

service portal is where its at anyways.... sweet!!