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 placeholder function?

hurm
Tera Contributor

I want to give the user a hint when entering information in from table's column

like below

please help me thanks

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

it's possible for string field

Use onLoad client script

function onLoad(){

	var field1 = g_form.getControl('fieldNameHere');
	field1.placeholder = "123-45-678";

}

Regards
Ankur

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

View solution in original post

5 REPLIES 5

GulshanSharma
Tera Contributor

Hi Guys,

i am having this requirement,
where this placeholder functionality is being used on catalog item

this code is written on onLoad Client script
currently we are using g_form.setFieldPlaceholder('watchlist','Test Message');
also, this watchlist variable is of list collector type
but this code is not supported in Virtual agent, are there any other ways how we can achieve this