Render g_form.showFieldMsg with HTML

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 07:55 PM
I want to output a g_form.showFieldMsg with a word in bold.
I have tried using UI Messages, ${AMP}, < & > to no avail.
Can this be done cleanly?
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 09:02 PM
Hi Paul,
You may find the below thread helpful.
Re: g_form.showFieldMsg background width adjustment.
How to change the HTML that g_form.showFieldMsg generates in the DOM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 09:03 PM
Hi Paul,
One way you can achieve it through client script:
I was able to make the error message text size bigger.
function onLoad() {
g_form.showFieldMsg('number','Hello World!','error');
if($j('div.notification-error').length){
$j('div.notification-error').css('font-size','20px');
}
}
As per wiki, I should also be able to do the same with below properties but for some reason it didn't work for me (may be it works for older releases).
The css.outputmsg.info.text.font-size property sets the size for info messages. Default is 11pt
The css.outputmsg.error.text.font-size property sets the size for error messages. Default is 11pt
Hope it helps!
-Manjul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 09:37 PM
I'm looking to make one word in a sentence bold/strong without direct DOM manipulation.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2016 02:10 AM
The short answer is No, this cannot be done with the g_form.showFieldMsg function.
If you look at the source code for the function you can see the message is added to the DOM as a '#text' node type; which does not support processing embedded mark-up.
var fieldMsgRow = doc.createElement('DIV');
fieldMsgRow.className = msgClass;
fieldMsgRow.hasFieldmsg = true;
var fieldmsgMsg = doc.createTextNode(message);
fieldMsgRow.appendChild(fieldmsgMsg);
fieldMsgContainer.insert(fieldMsgRow);
I hope this helps.