Display error message in front of modal

gordypow
Kilo Contributor

My modal form displays in front of my questionnaire form using the calendar widget.
Entering an invalid date causes an error message to appear behind the modal. It is faded out. It is from the g_form.addErrorMessage(). We are prohibited from using 'alert'. The addInfoMessage() behaves the same.

If the user clicks anywhere on the screen, the modal closes and we can see the error message.
It will fade on its own or we can click the 'x' to close it.
We will have to re-open the modal to enter another date.

I have only found a way to display the error message at the top of the questionnaire form. Is there a way to display it at the top of the modal form where it can be seen?

2 REPLIES 2

yundlu316
Kilo Guru

Hi, we're running into the same issue, have you come up with a solution?

LA_
Tera Expert

Hi. I encountered the same issue. I was working on a custom service portal. I have a custom widget that is getting displayed through a modal. The modal asks for some input which are mandatory. When a user clicks submit through the modal and missed some mandatory fields, I use the spUtil.addErrorMessage to throw out the error message. However the message displays behind the modal which is not a nice experience. 

 

Is the modal getting called from a Service Portal page? If yes, then the knowledge article below might help.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0744933