- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2017 04:13 AM
I have an 'onLoad' script that will make the help text always visible. But instead, I need an onChange script that will display it conditionally. If 'designate_proxy' field = yes, the help text should expand:
How can I modify the script for this to work?:
var myVar = g_form.getControl('designate_proxy');
toggleHelp(myVar.id);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2017 06:04 AM
Hi Nicole,
Please try somthin like below:
function onChange(){
var val =g_form.getvalue('designate_proxy');
if(val == 'true'){
var elems = document.getElementsByClassName('sc-help-text annotation-wrapper');
for (var i=0;i<elems.length;i+=1){
if (elems[i].style.display === 'none') {
elems[i].style.display = 'block';
}
}
}
let me know if you not able to get becuase here sode i didn't tested but logic should be
first get the checkbox value and based on true false you have to display the helptext.
if its not works please let me know .
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2017 04:46 AM
Hi Nicole,
There is nothing in ServiceNow which allows dynamic help text to be shown/hide. Something you can do is with HTML DOM manipulation.
If I find anything then I will put it here.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2017 05:02 AM
Hi Nicole,
Have following jquery logic in your onChange client script.
the highlighted part you can find by finding the html element.
The html id for my example is : question_help_IO_809e9d3c4f813200fc11fa218110c78b_toggle_value
It would be different in your case.
function onChange(){
if(newValue == 'yes'){
$j('#question_help_IO_809e9d3c4f813200fc11fa218110c78b_toggle_value').show(); // show the help text div
}
else if(newValue == 'no'){
$j('#question_help_IO_809e9d3c4f813200fc11fa218110c78b_toggle_value').hide(); // hide the help text div
}
}
Screenshot for DOM:
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2022 01:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2022 03:58 AM
Hello Vishal
Go to List View of Client script add isolate script checkbox
If it true make false or Vice Versa
Please mark as Helpful if it helped to resolve your query
Thanks
Hemant Kumar Ch