- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 09:34 AM
Hello Community,
Please how to I add a ghost texts to a place holder? I will like to add some ghost texts to a text box as a form of additional information that will disappear once the user starts to type into the text box.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 10:07 AM
Which table form do you want this placeholder text to appear in? Write an onLoad Client script for that table and the script is:
function onLoad() {
u_addPlaceholderAttribute('u_client', 'Testing placeholder \r\n new line \r\n 3rd line \r\n 4th \r\n this is last');
}
Then write a UI script (because this can be used again anywhere) that goes like this:
function u_addPlaceholderAttribute(variableName, hint) {
try{
var fieldName = g_form.getControl(variableName).name.toString();
if (Prototype.Browser.IE) {
fieldName.placeholder = hint;
} else {
$(fieldName).writeAttribute('placeholder', hint);
}
} catch(err) {}
}
The function call (u_addPlaceholderAttribute) in the onLoad client script should be the function name (u_addPlaceholderAttribute) you give in the UI script. Is this what you did? In my example, 'u_client' is the name of the field where I wanted my placeholder.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 09:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 09:41 AM
Thanks, I will been struggling with it before I created the post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 09:45 AM
This is what I did...
function u_addPlaceholderAttribute(reporting_criteria, hint) {
try{
var fieldName = g_form.getControl(reporting_criteria).name.toString();
if (Prototype.Browser.IE) {
fieldName.placeholder = hint;
} else {
$(fieldName).writeAttribute('placeholder', hint);
}
} catch(err) {}
}
reporting_criteria is the variable name.
I get an error message: "Missing function declaration for onLoad" I have no idea what that means.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 10:07 AM
Which table form do you want this placeholder text to appear in? Write an onLoad Client script for that table and the script is:
function onLoad() {
u_addPlaceholderAttribute('u_client', 'Testing placeholder \r\n new line \r\n 3rd line \r\n 4th \r\n this is last');
}
Then write a UI script (because this can be used again anywhere) that goes like this:
function u_addPlaceholderAttribute(variableName, hint) {
try{
var fieldName = g_form.getControl(variableName).name.toString();
if (Prototype.Browser.IE) {
fieldName.placeholder = hint;
} else {
$(fieldName).writeAttribute('placeholder', hint);
}
} catch(err) {}
}
The function call (u_addPlaceholderAttribute) in the onLoad client script should be the function name (u_addPlaceholderAttribute) you give in the UI script. Is this what you did? In my example, 'u_client' is the name of the field where I wanted my placeholder.