Correct way to make a form label bold? (For Service Portal)

Ted18
Tera Contributor

I have 2 different ways to make a label on a form bold.

  • A catalog client script
  • And a field style


I am sure I could get it to work for either but the issue is that I do not what object to select to apply the CSS. What I have been trying is:

function onLoad() {

var el = g_form.getControl('add_new_rule_label'); // The name of the label variable

el.style.fontWeight = 'bold';

}

Also with getLabel instead.

Is there a different method I should be using?

 

8 REPLIES 8

sriram35
Kilo Guru

Hi,

 

Please use below script

 

g_form.getcontrole (field name).style.fontweight='bold';

 

Please refer below links also

https://community.servicenow.com/community?id=community_question&sys_id=39ac87e5db9cdbc01dcaf3231f96...

 

https://community.servicenow.com/community?id=community_question&sys_id=c967ef49db347b0ca39a0b55ca96...

 

Hope this helps!

If you have any more questions, please let me know.

If I have answered your question, please mark my response as correct and helpful.

Thanks,

Sriram

 

Vishakha
Mega Guru

Hi Ted,

First you need to set the   sys_properties glide.ui.escape_text to 'fasle'

then apply the blow line it will work

in Question Field:<font size=4 color='green'><b>Name</i></font> 

Refer below thread for more understanding,

https://community.servicenow.com/community?id=community_question&sys_id=f2628beddb98dbc01dcaf3231f96...

 

Please mark correct and helpful if you find my response worthy based on the impact.

Regards,

Vishakha

Onkar Pandav
Tera Guru

Hi Ted,

Just want to add here that the methods getControl()getHelpTextControl()getElement(), and getFormElement() are deprecated for mobile devices.

Please check below links.

How do I set short_description field your label bold

https://docs.servicenow.com/bundle/orlando-application-development/page/script/client-scripts/refere...

Mark helpful/correct based on impact.

Pratiksha Kalam
Kilo Sage

Hello,

You need to write onload() client script. becuase font style is applicable to inside text.

Tried to getlabel but not working.

You can go to client script way as other mentioned.

 

If answer is helpful please mark correct or helpful!

Thanks,

Pratiksha