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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

We already have an "email" component, so this is probably a trivial change. HEAD is Drupal 7 and DRUPAL-6--3 is for Drupal 6.

quicksketch’s picture

Title: e-mail field input type » Use HTML5 type="email" for e-mail field input type

I 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.

daykkin’s picture

Assigned: Unassigned » daykkin

So what solution we have, to change type="text" with type="email" and etc on drupal 6? It is very needed thing for me.

quicksketch’s picture

Seems 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.

quicksketch’s picture

In #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.

quicksketch’s picture

Version: 6.x-3.2 » 6.x-3.15
Status: Active » Fixed

Committed to both 3.x branches. This'll be in the 3.16 version when it comes out.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

carlos.macao’s picture

This 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]')) {

Dret’s picture

Status: Closed (fixed) » Active

Hi 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!

Isostar’s picture

I also get a W3C validation error like #9

quicksketch’s picture

Status: Active » Closed (fixed)

@Dret: See #1375708: Provide a site-wide setting for utilizing HTML5 elements

Let's keep this issue as a feature request closed.