HTML5 placeholder

2010-12-23 Thread alexh
Hi, I was wondering there is a way to add an HTML5 attribute like placeholder to a text input tag within UIBinder or doing so otherwise in normal Java code. Thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group,

Re: HTML5 placeholder

2010-12-23 Thread Daniel Simons
You could call setAttribute on the UiField. This would look like the following: yourField.getElement().setAttribute(placeHolder,content of placeholder); Daniel On Thu, Dec 23, 2010 at 8:41 AM, alexh alexanderhar...@gmail.com wrote: Hi, I was wondering there is a way to add an HTML5

Re: HTML5 placeholder

2010-12-23 Thread Thomas Broyer
I'd rather use setPropertyString though, given that there's a property reflecting the attribute: yourField.getElement().setPropertyString(placeholder, content of placeholder); (i.e. in JS, you'll more likely write myInputText.placeholder=content of placeholder than

Re: HTML5 placeholder

2010-12-23 Thread Harald Pehl
I created a simple subclass so that I can use the placeholder property in UIBinder: public class PlaceholderTextBox extends TextBox { public void setPlaceholder(String placeholder) { InputElement inputElement = getElement().cast(); inputElement.setAttribute(placeholder,

Re: HTML5 placeholder

2010-12-23 Thread Daniel Simons
I tried a test using setPropertyString, and cannot get it to work. Am I wrong in thinking that 'this[name] = value;' is not useful in this case b/c placeHolder should be an actual element attribute rather than a property that is referenced in js? Daniel On Thu, Dec 23, 2010 at 9:12 AM, Thomas

Re: HTML5 placeholder

2010-12-23 Thread Thomas Broyer
Works for me (tested in Chrome 10-dev using the Web inspector's JS console), but it has to be placeholder with a lower-case h, not placeHolder. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to