How to make a question text bold in a service catalog

vidhya_mouli
Giga Sage

I tried adding the following catalog client script, but it changes only the value and not the question.

 

 

function onLoad() {
	g_form.getControl('new_email').setAttribute('style', 'font-weight: bold');
}

 

1 ACCEPTED SOLUTION

Hey @vidhya_mouli ,

 

I have it working perfectly fine with the configurations I specified in my answer. Double-check the code and your script configuration. I can see in your code that you don't have the 'label' tag after the variable name in the jQuery. You need to specify 'label' afterward.

 

 

// a_variable is the name value for the variable label you want to set to bold.
setTimeout(function() {
     // Dont forget to add the "label" attribute after your variable name. My variable name is a_variable and I add a space and label after it. You need to do the same.
      this.$('#a_variable label').css('font-weight', 'bold');
}, 200);

 

 

Also, make sure:

  1. You set 'Isolate Script' to FALSE on your Catalog Client Script
  2. You set the UI Type to Portal or All (Preferably Mobile/Portal)

EthanDavies_1-1707830316261.png

 

EthanDavies_0-1707830256276.png

 

View solution in original post

13 REPLIES 13

ARUN MANOJ
Tera Contributor

Hi,

please use below code.

 

function onLoad() {

var questionElement = g_form.getControl('hardware_type');

if (questionElement) {

questionElement.style.fontWeight = 'bold';

}

}

if it is helpful.

Community Alums
Not applicable

I am trying to do this in portal and it does not work.

Ethan Davies
Mega Sage
Mega Sage

Try this code in your onLoad Client Script. You will need to set the Isolate Script attribute to False on your Client Script.

 

// a_variable is the name value for the variable label you want to set to bold.
setTimeout(function() {
      this.$('#a_variable label').css('font-weight', 'bold');
}, 200);