Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there!
After seeing the splendid keynote of Jeremy Keith, i am diving in the wonderful world of HTML 5.
I know html5 is still a draft, but we already can use some new elements like the e-mail input type.
I wanted to make a patch for this, but i see head is for D7 already, so i'm a bit confused.
Is it best to apply this to head and then backport this for D6 and D5?
Or is changing the input type a bit too early?
Anyhow, older browsers that don't support the e-mail input type will render this as a plain text field.
Greetings,
Tom
Comment | File | Size | Author |
---|---|---|---|
#5 | webform_html5_email-d6.patch | 4.71 KB | quicksketch |
#5 | webform_html5_email-d7.patch | 3.83 KB | quicksketch |
Comments
Comment #1
quicksketchWe already have an "email" component, so this is probably a trivial change. HEAD is Drupal 7 and DRUPAL-6--3 is for Drupal 6.
Comment #2
quicksketchI should note that the immediate benefit we get from this change is that mobile devices like iPhones and Android phones give you a keyboard suitable for entering e-mail addresses (including the @ sign and .com) when type="email". Versus a text field they present the normal all-purpose keyboard.
Comment #3
daykkin CreditAttribution: daykkin commentedSo what solution we have, to change type="text" with type="email" and etc on drupal 6? It is very needed thing for me.
Comment #4
quicksketchSeems like utilizing http://drupal.org/project/elements would be the best approach to use here, since you can't set #type = 'email' and have it work with Drupal out-of-box. Utilizing Elements might also have the benefit of automatically utilizing its advanced options if the module exists, rather than creating more options within Webform.
Comment #5
quicksketchIn #260708: Number component (Numeric field), we've solved this problem simply by creating a "webform_number" element. This was remarkably simple, and not as much work as I had been anticipating. Considering all input elements already gracefully degrade without an HTML5 shim/shiv, I don't see any reason to depend upon another module for this functionality.
Here are two patches which provide a type="email" element for both D6 and D7.
Comment #6
quicksketchCommitted to both 3.x branches. This'll be in the 3.16 version when it comes out.
Comment #8
carlos.macao CreditAttribution: carlos.macao commentedThis breaks Compact Forms.
To solve the problem I've patched compact_form.js at line 21 from:
if (!$field.length || !$field.is('input:text,input:password,textarea')) {
to:
if (!$field.length || !$field.is('input:text,input:password,textarea, [type=email], [type=tel], [type=url], [type=number], [type=range], [type=date], [type=time], [type=datetime], [type=datetime-local], [type=month], [type=week], [type=color], [type=search]')) {
Comment #9
Dret CreditAttribution: Dret commentedHi to all,
I would like to purpose a setting for choosing the markup syntax between HTML5 and XHTML (or HTML 4) for INPUT tag .
At this time, my XHTML theme is invalidated by modification introduced in the last version about:
<strong> input type="email"</strong>
Considering I have a webform in all my site pages... ALL my site now appears as an invalid theme code for W3C standard.
In this way only HTML5 themes were supported. It seems to be an extreme choice considering that HTML5 in still in DRAFT!
Thanks!
Comment #10
Isostar CreditAttribution: Isostar commentedI also get a W3C validation error like #9
Comment #11
quicksketch@Dret: See #1375708: Provide a site-wide setting for utilizing HTML5 elements
Let's keep this issue as a feature request closed.