#12488 closed (wontfix)
Add EmailInput and URLInput widgets
Reported by: | Oliver Beattie | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As there is now a special HTML(5) email input type, I propose that there should be an EmailInput
widget as a part of Django. As documented here, it degrades gracefully in all browsers, so there is little reason not to use it. I understand that Django typically has supported HTML4/XHTML, so perhaps it should not be the default widget for the EmailField
, but the attached patch has it this way should anyone think it should be (I, for one, would be for this but I realize that it could invalidate some people's existing templates).
Attachments (2)
Change History (10)
by , 15 years ago
Attachment: | email_input.diff added |
---|
comment:1 by , 15 years ago
Summary: | Add an `EmailInput` to `django.forms.widgets` → Add `EmailInput` and `URLInput` widgets |
---|
by , 15 years ago
Attachment: | email_url_inputs.diff added |
---|
comment:2 by , 15 years ago
Summary: | Add `EmailInput` and `URLInput` widgets → Add EmailInput and URLInput widgets |
---|
comment:3 by , 15 years ago
Jeez, am I failsome today. The "here" I refer to in the ticket description ("As documented here, it degrades gracefully in all browsers") is a reference to this page.
comment:4 by , 15 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
The validation issue is a big one, unfortunately. At the moment, we can't have this as a default, which brings into question the usefulness of having this in Django at all. We normally ship components that work well together, and this one does not work well with the templates that ship with Django.
This brings up the bigger question of how to support the different dialects of HTML. In some ways, HTML5 could help us out here, as it supports both XHTML 'style' and HTML 'style' tags under the same DOCTYPE. But there are problems with adopting HTML5 at this point - like the backwards compatibility promise we have, which means we can't just go changing doctypes, and the fact that the spec isn't done and the lack of validator tools for it.
So, I'm closing WONTFIX, as we are not supporting HTML5 at this time.
comment:5 by , 15 years ago
It's probably worth noting that all browsers (dating back as far as IE6) degrade gracefully to input type="text" for email and url.
comment:6 by , 14 years ago
lukeplant:
Could you elaborate more on why you believe it breaks backwards compatibility? The fields degrade in all browsers. They produce both valid XML and valid HTML. The only thing that might change is the output of the W3C validator for non-HTML5 documents. And changing the DOCTYPE to "html" is a mere annoyance comparable to changing "maxlength" to "max_length" in model definitions.
comment:7 by , 14 years ago
patrys: Having <input type="url" > may degrade, but it doesn't validate. On top of that, Django's output rendering follows XHTML conventions; introducing rendering elements drawn from HTML5 starts to confuse matters.
That said, adding support for HTML5 is on my radar personally, along with a number of other form-rendering related improvements. Check the django-dev mailing list for recent discussions. I'm hoping to be able to sprint on this a little bit at DjangoCon.
comment:8 by , 14 years ago
Just to be clear: HTML5 allows XML style tags. There is also no loss when changing the doctype to plain "html".
On second thought, the new
<input type="url">
would be equally worthy of supporting here. I've attached a different patch. Of note is that on the iPhone, the visual keyboard layout is changed into an email-specific or URL-specific variant for the respective input types, so there is a real benefit to users of having this.