Correct way to make a form label bold? (For Service Portal)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2020 06:20 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2020 06:30 AM
Can you try this:
g_form. getControl('impact').style.fontWeight="bold";
If the variable is referemce type:
try this:
var myVar = $('sys_display.' + g_form.getControl('caller_id').id);
myVar.style.fontWeight="bold";
https://www.servicenowguru.com/system-ui/field-styles-service-catalog-variables/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2020 06:30 AM
Hi Ted,
Refer this Url : https://www.servicenowguru.com/system-ui/ui-scripts-system-ui/modifying-label-form-fields-client-scr...
Try these ways :
function onLoad() {
//Change the description label to 'My New Label' with bold red text
changeFieldLabel('description', 'My New Label', 'red', 'bold');
}
function changeFieldLabel(field, label, color, weight){
try{
var labelElement = $('label_' + g_form.getControl(field).id);
labelElement.select('.sn-tooltip-basic').each(function(elmt) {
elmt.innerHTML = label;
if(color)
elmt.style.color = color;
if(weight)
elmt.style.fontWeight = weight;
});
}catch(e){};
}
or
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2020 06:35 AM
Hi Ted,
Please refer this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2020 06:37 AM
Hi Ted,
Can you please try like below:
function onLoad() {
var l = g_form.getLabel('short_description');
l.style.fontWeight='bold'; }