Add placeholder text in <g:ui_reference> field on a UI Page.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2015 05:53 AM
Since this won't work: <g:ui_reference name="QUERY:u_locationISNOTEMPTY" table="u_bcp_sites" placeholder="Choose a site..." />
One must get crafty. This will do the trick:
First, the jelly portion:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
addLateLoadEvent(function(){
setPlaceholderText();
});
</script>
...
...
Now the Client Script portion:
function setPlaceholderText()
{
var el = gel('sys_display.QUERY:u_locationISNOTEMPTY');
if (el)
el.placeholder = "Choose a site...";
}
Even though I got this to work, is this the only way to get placeholder text in a <g:ui_reference> field on a UI Page ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2015 06:36 AM
I don't think that ui_reference macro supports a placeholder attribute being passed to it, so I think the client script is really your only option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 06:29 AM
Hi Brad Tilton,
How to put place holder on custom field through clientscript..??Any script??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 06:34 AM
Hi david,
Please find this helpful thread in your case: Support for HTML 5 placeholder attribute
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2017 01:52 AM
Great news, I've heard that HTML Placeholder will be supported natively in Jakarta!
I've written a blog article on the subject: Great UX Trick: HTML Placeholders