gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.52k stars 376 forks source link

Support HTML5 form fields and attributes #5294

Open dankurka opened 9 years ago

dankurka commented 9 years ago

Originally reported on Google Code with ID 5295

Please add support for HTML5 form fields and attributes (placeholder, autofocus, required)
as GWT widgets. 

http://diveintohtml5.org/forms.html
dev.w3.org/html5/spec/

Just generate HTML5 markup, nothing else (e.g. don't fallback to GWT datepicker if
browser doesn't have support).

Reported by marius.andreiana on 2010-09-21 08:55:09

dankurka commented 9 years ago
Please add file input [multiple] option and file to data url. 

Brandon Donnelson
http://code.google.com/p/gwt-examples/wiki/gwt_hmtl5

Reported by branflake2267 on 2011-03-26 14:11:14

dankurka commented 9 years ago
We're adding the "multiple" option in this CL: http://gwt-code-reviews.appspot.com/1786803/

Reported by skybrian@google.com on 2012-07-20 20:21:27

dankurka commented 9 years ago
@brian is this commited? Can we close the issue?

Reported by dankurka@google.com on 2013-06-03 14:29:59

dankurka commented 9 years ago
Issue 4002 has been merged into this issue.

Reported by t.broyer on 2013-06-03 20:56:46

dankurka commented 9 years ago
It'd be great to have placeholder="" (originally reported as issue 4002) as that's something
that's well-supported in mobile (http://caniuse.com/input-placeholder), that I've had
to add in a couple projects in TextBox subclasses, and that has a clean fallback (if
used correctly).

BTW, the multiple="" patch hasn't been merged; IMO it should come with FormData and/or
FileReader/Blob support to be really useful.

As for autofocus, I don't think it's worth it, it's only really useful on load; and
validation needs more work to provide a reasonable fallback in browsers where it's
not supported.

Reported by t.broyer on 2013-06-03 21:17:26

andirady commented 5 years ago

Anyone working on this? I really like to have the placeholder attribute on TextBox.

jonl-percsolutions-com commented 5 years ago

You can call widget.getElement().setAttribute() to set these attributes.

andirady commented 5 years ago

You can call widget.getElement().setAttribute() to set these attributes.

Sorry, I forgot to mention that I mostly build the UI using the UiBinder. I need the setPlaceholder method so that I can do this:

<gwt:TextBox placeholder="Type here..."/>
tbroyer commented 5 years ago

fwiw, we have a class TextBox extends com.google.gwt.user.client.ui.TextBox that adds the placeholder property so we can use it in UiBinder templates (as I explained in 2013 above)

niloc132 commented 5 years ago

New improvements like this might be better put into the migrated gwt-widgets project (currently living at https://github.com/treblereel/gwt-widgets/, will move to github.com/gwtproject when its dependencies are ready). Adding a feature like placeholder while GWT ostensibly supports IE8 and 9 (which don't support the placeholder attribute) either means that it just doesn't work in some supported browsers, or that extra work will need to be done to emulate it.