Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to add watermark information message on the string field?

Aamir3
Tera Contributor

Hi All,

I have a basic requirement of adding the watermark text on my String field called "justification" which is extended from the task table field "Description".  I need watermark text message information in the justification field, which will disappear once you write in that field. Can you guys please help me achieve this?

Aamir3_0-1702570982683.png

 

2 ACCEPTED SOLUTIONS

Rahul RJ
Giga Sage

@Aamir3 You can create on load client script to show placeholder text in the field 

 

function onLoad() {
   //Type appropriate comment here, and begin script below
   var field = g_form.getControl('description');
field.placeholder = "Test Placeholder";
}

 

RahulRJ_0-1702571772616.pngRahulRJ_1-1702571786659.png

Hope this will resolve your issue.

 

Thanks,

RJ

 

View solution in original post

Dom Gattuso
Mega Sage

@Aamir3 I believe what you are looking for is called placeholder text which is text that appears in the field but disappears when a user inputs text. 

 

You can achieve this with the following client script (onload): 

 

var field1 = g_form.getControl('fieldName');
field1.placeholder ="Placeholder text";

 

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Aamir3 

 

There is attribute called Example Text , which is available on Variables but not on fields. You can use Default value , but it wil not solve your issue

 

LearnNGrowAtul_0-1702571443034.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Rahul RJ
Giga Sage

@Aamir3 You can create on load client script to show placeholder text in the field 

 

function onLoad() {
   //Type appropriate comment here, and begin script below
   var field = g_form.getControl('description');
field.placeholder = "Test Placeholder";
}

 

RahulRJ_0-1702571772616.pngRahulRJ_1-1702571786659.png

Hope this will resolve your issue.

 

Thanks,

RJ

 

Dom Gattuso
Mega Sage

@Aamir3 I believe what you are looking for is called placeholder text which is text that appears in the field but disappears when a user inputs text. 

 

You can achieve this with the following client script (onload): 

 

var field1 = g_form.getControl('fieldName');
field1.placeholder ="Placeholder text";

 

Aamir3
Tera Contributor

Thanks everyone! Now I can achieve my requirements. Much Appreciated!