I’m looking for a way to specify the placeholder attribute inside a <g:SuggestBox> element, in GWT.
I know that the <input> element allows to specify that attribute, but I decided to switch to the SuggestBox element instead of the input one.
Can anyone help me?
You should create your own custom SuggestBox widget, after that you can set placeholder attribute to it. For example:
So, you can set this property in UI binder.
PS: It works only in modern browser. For implementing it correctly for older browsers as well check out third-party lib wogwt, it has TextBoxWithPlaceholder class which extends TextBox:
In that case you can send this
TextBoxWithPlaceholder‘s instance toSuggestBox(SuggestOracle oracle, TextBoxBase box)constructor.