How to change the HTML that g_form.showFieldMsg generates in the DOM

kevinanderson
Giga Guru

We are interested in changing the way error and info messages are displayed on catalog items.   We use g_form.showFieldMsg on many of our forms, and would like to find a way to change the HTML this function inserts into the DOM.   We would like to have these messages inserted into the container to the right of the target input as an icon, that on-hover over the icon, would display the message.     Is it possible to edit the components that g_form.showFieldMsg uses to render to the page?

2 REPLIES 2

rakesh_ravi
ServiceNow Employee
ServiceNow Employee

g_form is shipped with the ServiceNow platform and the styling for the field messages displayed inline to the fields comes from the platform. You can apply some dirty DOM hacks by writing global UI scripts and overriding g_form.showFieldMessage property.


Having said that, i would advise you to take this route. It is not good to manipulate any platform APIs. You will easily run into problems for getting it with all the fields. Platform API have been built over a period of time and are equipped to handle all the cases. All the these will be fully supported in case of an upgrades or other similar stuff whereas DOM hacks will most probably break in such cases.



Hope this helps.



Let me know in case you need more information.


ryannnnnnnnnnnn
Tera Contributor