HTML Help text

Brian Lancaster
Tera Sage

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.

37 REPLIES 37

venkatiyer1
Giga Guru

Hi Brian,



Try this script on onload, it should work for this example. Ignore my previous script.   The script below will ensure you can display html as html for all the help text on the page.



$j(".sc-help-text" ).each(function( index ) {


var html = $j(this).text();


var regex = /(https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/ig


var replaced_text = html.replace(regex, "<a href='$1' target='_blank'>$1</a>");


$j(this).html(replaced_text); // If this doesnt work we can empty the tag and append the replace_text to $j(this)


});


Hi Venkat,



I tried this script onLoad and my help text is as shown below.



find_real_file.png



But after clicking it is not going to the site and comes as below.


find_real_file.png



Please suggest. I am not getting what needs to be changed in the onLoad script.


Hello Ricky,


I found this code in another post and it worked for me.   I used it in a on load script.



  1. $j(function($){  
  2.       $('table.help_table td:first-child:not([data-htmlized=true])').each(function(){  
  3.               var help = $(this);  
  4.               help.data('htmlized','true').html(help.text());  
  5.       });  
  6. });

Hi Brian,



This code works fine for me as well but i want that help text to be seen at all times instead of the user clicking on the more information button.



Do you know how to get that ?



Thanks,


Praveen.


Hi Praveen,



Please refer below link to show up help-text all times.



Show/Hide Service Catalog Variable Help Text - ServiceNow Guru