- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2019 10:45 PM
Hi all,
I need to show info message when an option is selected from the select box:
select box variable: Department (department)
Value for the select box optioin - '2' (Text - 'IT')
Script onChange:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Field message that will inform the user what will happen when they pick this selection
if(g_form.getValue('department')=='2'){
g_form.showFieldMsg('department','If the issue is urgent please see Service Desk','info');
}
else{
g_form.hideFieldMsg("department");
}
}
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2019 10:48 PM
What you r trying to write is correct
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Field message that will inform the user what will happen when they pick this selection
if(newValue ==2){
g_form.showFieldMsg('department','If the issue is urgent please see Service Desk','info');
}
else{
g_form.hideFieldMsg("department");
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2019 10:48 PM
What you r trying to write is correct
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Field message that will inform the user what will happen when they pick this selection
if(newValue ==2){
g_form.showFieldMsg('department','If the issue is urgent please see Service Desk','info');
}
else{
g_form.hideFieldMsg("department");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2019 10:58 PM
Thanks for the reply Chalan, but it still does not show the info message, is it because the selection box is under "department" variable? Can we show on the selection choice value which is 2 in this case?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2019 11:21 PM
Hello Sam,
Just tried in my PDI and the above code is working
Onchange Client script
onchange of Title to testValue then it is displaying infomessage in description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2019 11:26 PM
Hi Sam,
We have tried replicating your issue and below are the assumptions taken:
We assume you have used the catalog client script to show the field message(client script).
Small correction in the else part that instead of having the field name in double quotes "g_form.hideFieldMsg("department"); " can you please change to single quote
g_form.hideFieldMsg('department');
Please provide filed values (choices)