How to add watermark information message on the text field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 09:54 AM
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.
This is my form screen where I want a "Watermark text".
Kind regards,
Manish
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 10:21 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 10:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 11:51 AM
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
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 03:50 AM
Thanks Ravindra & Shiva, you both have given the similar ans & this is helpful.