- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2017 08:59 AM
Hi,
How can I add shadow text for ServiceNow forms? I dont see any option to add it in the Studio - Forms.
I'm looking for something like this (In the text filed - "Optional - Enter Phone No").
Any workaround or help is highly appreciated Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 08:22 PM
By default, ServiceNow blocks updating DOM objects in scoped applications.
You need to add below system property and set it to false.
glide.script.block.client.globals
and use below function to set placeholder text in on load script.
u_addPlaceholderAttribute('field_name', 'YYYY-MM-DD');
function u_addPlaceholderAttribute(variableName, hint) {
var fieldName;
try{
if(variableName.indexOf('phone') >= 0)
{
fieldName = g_form.getControl(variableName).name.toString();
fieldName = 'disp_'+fieldName;
}
else{
fieldName = g_form.getControl(variableName).name.toString();
}
if (Prototype.Browser.IE) {
fieldName.placeholder = hint;
} else {
$(fieldName).writeAttribute('placeholder', hint);
}
} catch(err) {}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 08:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 08:08 PM
is it a scoped application ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 08:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 08:22 PM
By default, ServiceNow blocks updating DOM objects in scoped applications.
You need to add below system property and set it to false.
glide.script.block.client.globals
and use below function to set placeholder text in on load script.
u_addPlaceholderAttribute('field_name', 'YYYY-MM-DD');
function u_addPlaceholderAttribute(variableName, hint) {
var fieldName;
try{
if(variableName.indexOf('phone') >= 0)
{
fieldName = g_form.getControl(variableName).name.toString();
fieldName = 'disp_'+fieldName;
}
else{
fieldName = g_form.getControl(variableName).name.toString();
}
if (Prototype.Browser.IE) {
fieldName.placeholder = hint;
} else {
$(fieldName).writeAttribute('placeholder', hint);
}
} catch(err) {}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2017 08:42 PM
Hello Nish,
That was amazing! It worked.
Just curious...how did you find this system property glide.script.block.client.globals ?
I checked in the system properties from link below and I didn't see this -
http://wiki.servicenow.com/index.php?title=Available_System_Properties#gsc.tab=0
Thank you Jim & Nish for your support. It was of great help!