The CreatorCon Call for Content is officially open! Get started here.

Field message disappearing when clicking on form

matthew_hughes
Kilo Sage

I've created the following client script to show a field message on a form:

matthew_hughes_0-1698322193048.png

 

 

When the form loads, it appears:

matthew_hughes_1-1698322228989.png

 

However, if I click on any part of the form, it disappears:

matthew_hughes_2-1698322264582.png

 

I was just wondering if someone could explain what I'm doing wrong and how I keep the field message appearing.

 

 

8 REPLIES 8

@Ankur Bawiskar  In fact, it just works with the onChange client script without the needs for onload client script:

matthew_hughes_0-1698327950203.png

 

Could I just use the one client script or would I need to use both?

@matthew_hughes 

yes remove onLoad in that case

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@matthew_hughes 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

_Gaurav
Kilo Sage

Hi @matthew_hughes To achieve you can use onChange client script and select the action variable and comment out the return so that the script will run on both onLoad and Onchage and write your showFieldMessage method.


Please mark helpful if it solves your query

Gaurav