HTML Help text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2016 08:49 AM
Does anybody know of a way to make it so that HTML shows in the help test now that ServiceNow is escaping it? We obviously do not want to set glide.ui.escape_text to false. Just wondering if there are any other workarounds before we have to upgrade to Fuji Patch 12 Hot fix 1. We have tables setup to show what the different choices mean on a list collector.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2017 10:45 AM
Hello Brian,
I saw your question and I know that this is a little bit old, but I have a solution for your problem, I have created the following function to solve the issue in Fuji without modifying any system property and it works fine for me.
The only way to do this is using DOM manipulation using an onLoad script, this is not recommended by ServiceNow but sometimes we have to implement the changes in this way to fulfill the requirements.
Just pass the name of your variable in the parameter of the function unescapeHelpText inside the onLoad script created, and the code will do the magic for you:
function unescapeHelpText(pField)
{
//Set the name of the field in the 'field' variable
var field = pField;
//Append the table name to get the field id
field = g_form.getControl(field).id;
var vId = field.toString().replace(/sys_original./g, '');
//Construct the id of the container of the help text
var vHelpID = 'help_' + vId + '_wrapper';
//alert(vHelpID);
//Get escaped HTML code
var vEscapedHelpText = document.getElementById(vHelpID).innerHTML;
//alert('vEscapedHelpText:\n' + vEscapedHelpText);
//Replace escaped characters
var vHelpText = '';
vHelpText = vEscapedHelpText.toString().replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, ' ');
//alert('vHelpText:\n' + vHelpText);
document.getElementById(vHelpID).innerHTML = vHelpText;
}
Hope this code help you.
Regards!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2017 11:38 AM
Sorry I thought I had marked this as answered. When we were on Fuji I found this code the fixed the issue in an Onload script
$j(function($){
$('table.help_table td:first-child:not([data-htmlized=true])').each(function(){
var help = $(this);
help.data('htmlized','true').html(help.text());
});
});
When we moved to Helsinki we had to update the code to this which was provided by Venkat Iyler.
$$("div.sc-help-text").each(function(item){
var textValue = item.innerText;
$(item).update(textValue);
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2018 07:14 AM
Is this still working for you?
I used the same script and now its throwing a dirty form error message.
Thanks,
Jocelyn
