
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2014 08:40 PM
How do I modify the Help Label of Form Fields With Client Scripts? I have a requirement that I dynamically modify the label of a variable in the Service Catalog. I have found plenty of help to accomplish this:
https://community.servicenow.com/message/714821
http://www.servicenowguru.com/system-ui/field-styles-service-catalog-variables/
With the suggestions in these resources, I am able to modify the label using Catalog Client Scripting. But I can't figure out how to dynamically modify the help label (normally shown as "More Information" adjacent to the label). Does anyone know how to do this?
Thank you!
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2014 10:13 AM
Hi Larry,
Try this
var variableID = g_form.getControl('variableName').id;
var labelElement = gel('help_'+variableID +'_wrapper');
labelElement.select('td').each(function(elmt) {
if(elmt.className == '')
elmt.innerHTML = "What text you want";
});
Thanks and regards,
Pratik Limbore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2014 11:53 PM
Hi Larry,
In Eureka mandatory marker comes as a part of Labels, so simply using inner HTML over rides the * too. So what I did was somehting like this
function onLoad() {
var x ;
var y;
var s='';
var lab1=g_form.getLabel("Field Name");
s ='New Label'; //This is the new label
lab1.innerHTML= fixLabel(lab1.innerHTML, s);
}
//This function extracts the mandatory control part, and just replaces the label
function fixLabel(x,y)
{
var a = x.indexOf('span>');
var b = x.substring(a+5);
var t = x.replace(b, y);
return t;
}
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2014 09:21 AM
Thanks, but this seems to just change the label and not the text that appears when you click on the More Information link under the label. What my customer wanted was to dynamically change the helper text and not the label text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2014 04:20 AM
Hi,
Inside an onload client script, create a function which modifies the label.
Eg
function changeFieldLabel(field, label, color, weight){
try{
var labelElement = $('label.' + g_form.getControl(field).id);
labelElement.select('label').each(function(elmt) {
elmt.innerHTML = label + ':';
});
if(color)
labelElement.style.color = color;
if(weight)
labelElement.style.fontWeight = weight;
}catch(e){};
}
You can call this function from other clients scripts and the label will be changed, like onChange() of a field.
Hope this is what you meant by dynamically.
Thanks and regards,
Pratik Limbore

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2014 09:21 AM
Thanks, but this seems to just change the label and not the text that appears when you click on the More Information link under the label. What my customer wanted was to dynamically change the helper text and not the label text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2014 10:13 AM
Hi Larry,
Try this
var variableID = g_form.getControl('variableName').id;
var labelElement = gel('help_'+variableID +'_wrapper');
labelElement.select('td').each(function(elmt) {
if(elmt.className == '')
elmt.innerHTML = "What text you want";
});
Thanks and regards,
Pratik Limbore