views:

46

answers:

1

I'm using GWT and UiBinder for my app, and I'm trying to do this

<g:TextBox ui:field="searchBox" styleName="{style.searchBox}" placeholder="search" />

But the custom placeholder attribute won't work because there isn't a setPlaceholder method on TextBox - I need to this:

searchBox.getElement().setAttribute("placeholder", "search");

back in the java code. Any ideas on how to do this in UiBinder itself? I suppose I could change it over to a normal input element and try to grab a reference and its value, but I'd rather not go down that road.

+2  A: 

What about creating custom SearchBox that extends TextBox with method setPlaceholder(String placeholder) ?
Then in UiBinder: <custom:SearchBox ui:field="searchBox" styleName="{style.searchBox}" placeholder="search" />
Sorry i'm unable to comment :(

Xo4yHaMope
That's probably what I'll eventually do in this case, but I see it getting more and more difficult to use HTML 5 features that are attribute based :(
Sudhir Jonathan