Updating variable help text dynamically?

rbertram
Kilo Expert

I am looking for a way to dynamically change the help text content for a catalog variable based on value of another variable.

2 REPLIES 2

rbertram
Kilo Expert

Thanks Jace. This is exactly what I was looking for.


Jace Benson
Mega Sage

The only way I could see you doing this is some DOM manipulation which is not recommended.

If you have to do it you'd have to first create an element you could grab, so your help text would have to be something like


<div id="dynamichelp">Default Text goes here</div>
.
Then you'd have to use your onChange script to find said element, and set the innertext to something else.
You will also need to modify the glide.ui.escape_text property to false;

I modified the script on the OOB iPhone4 item to show you this works, but yea,

You can use prototype (default in servicenow)


function onChange(control, oldValue, newValue, isLoading) {
if (newValue != '' &amp;&amp; !isLoading &amp;&amp; oldValue != newValue) {
$('dynamichelp').update('Some content goes here until you the dynamic stuff... ' + g_form.getValue("original"));
} else {
$('dynamichelp').update('Some other message');
}
}


I tossed this out on demo004 on the blackberry item, here's a direct link
https://demo004.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=e2132865c0a8016500108d9cee411699
Right now it's triggering off of the original variable changing.