How to add watermark information message on the text field?

Manish Singh
Kilo Expert

Hi All,

I have a basic requirement of adding the watermark text on my catalog variable text field same what we have in global search, below is my the screenshot.

find_real_file.png

This is my form screen where I want a "Watermark text".

find_real_file.png

Kind regards,

Manish

7 REPLIES 7

sachin_namjoshi
Kilo Patron
Kilo Patron

Hi Manish,



I am not sure about adding watermark.


You can utilize field hint for achieving this functionality.



http://wiki.servicenow.com/index.php?title=Field_Label_Help#gsc.tab=0



Regards,


Sachin


Shiva Thomas
Kilo Sage

Hi Manish,



This is called an HTML input placeholder and for some silly reason ServiceNow don't support them out of the box.



You can create still them using this very useful snippet of Javascript code in an onLoad client script:


function onLoad() { // Example usage in an onLoad client script


u_addHtlmPlaceholder('description', 'Please describe your issue with as most detail as possible.');




// Should be called in onLoad client scripts to add HTML placeholders attribute to fields in forms.


// Could be declared in a global script include.


function u_addHtlmPlaceholder(fieldName, placeholderText) {


  try {


    var control = g_form.getControl(fieldName).name.toString();


    if (Prototype.Browser.IE) fieldName.placeholder = placeholderText; // Workaround for Internet Explorer


    else $(control).writeAttribute('placeholder', placeholderText); // Modern browsers, using jQuery


  }


  catch(err) {} // Fail silently if field is not present in the form


}


}


Manish Singh
Kilo Expert

Thanks Ravindra & Shiva, you both have given the similar ans & this is helpful.