- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 12:17 AM
Hi All,
we do have a drop down reference field call "Area" in CatLog item.
under "Area" drop down values example 'A', 'B', 'C'.
I'm writing the on change CatLog client script to show the field msg based on the choice user selected:
Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (cat.Area == 'A')
{
g_form.showFieldMsg('Area', 'testing1');
}
else if (cat.Area == 'B')
{
g_form.showFieldMsg('Area','testing2');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 12:31 AM
There's no question here.
But if you're trying to get the value of a field on your form, then you'd have to use "g_form.getValue('field_name');
For example
if (g_form.getValue('Area') == 'A') {
g_form.showFieldMsg('Area', 'testing1');
}
You can also use g_form.getDisplayValue to get the shown value. For example on incident table choices for state are numbers as values but text as the display value.
Also note that if your field is named "area" then in your script you need to use "area". Usually field names are in lower case while the labels might start with uppercase letter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 12:31 AM
There's no question here.
But if you're trying to get the value of a field on your form, then you'd have to use "g_form.getValue('field_name');
For example
if (g_form.getValue('Area') == 'A') {
g_form.showFieldMsg('Area', 'testing1');
}
You can also use g_form.getDisplayValue to get the shown value. For example on incident table choices for state are numbers as values but text as the display value.
Also note that if your field is named "area" then in your script you need to use "area". Usually field names are in lower case while the labels might start with uppercase letter.