Show Field Message - Auto hides after a field is edited

jna2756
Tera Expert

Hi All,

We recently upgraded from Jakarta to Kingston and while testing we noticed that whenever a field on a catalog item is edited, if there is a was a field message shown on it (via g_form.showFieldMsg), the field message is automatically removed. In Jakarta it didn't do this, it left the field message there until a g_form.hideFieldMsg or g_form.hideAllFieldMsgs was invoked on it.

Is there a property that controls this functionality? or this the new way field messages work?

find_real_file.png

find_real_file.png

Thanks in advance!

-Josh

2 REPLIES 2

Abhishek77
ServiceNow Employee
ServiceNow Employee

Hi Josh,

When you use on Load client script for field message, as soon as you load the form the message will display under the field but when you enter some value in the field the message goes off.

If you want to display the field message even though if you enter the value, Write one more onchange client script with the same message. so that script will trigger and show you the field message even if field changes are made.

//tested

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.showFieldMsg('fieldname','message');
}

 

Please Hit Helpful /Correct answer depending on the impact of the response.

Hi Abhishek,

 

Thanks for the quick response, I already updated some of my scripts similar to how you described but I was hoping that their was a property I could have just changed instead. We have around 100+ scripts that do this and when we updated to Kingston, the way the field message works changed.

Thanks,

Joshua Anderson