Pretty straight forward issue, the Elements module adds the HTML 5 email field to Drupal, it would be nice to use this as the widget for the Email field if it is available.

Patch incoming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Deciphered’s picture

Status: Active » Needs review
FileSize
1.44 KB
zaporylie’s picture

Status: Needs review » Needs work

I think there is no need to create new HTML5 widget here. I would opt for just changing field #type to 'email_emailfield' if Elements module is installed. It is like that for Telephone module.

But if you would prefer your approach more than the one I've suggested above, it could be easily done by new contrib micro-module (i.e. email_elements or elements_email). No need to wait for module maintainers to commit your patch.

bgilhome’s picture

Here's a patch to check for 'elements' module and set form element type accordingly.

bgilhome’s picture

Actually we should also use only one element_validate callback if the elements module is installed - patch attached & interdiff to previous patch.

jackalope’s picture

Thanks for the patch @bgilhome! I just encountered this need and your patch seems to be working well for adding HTML5 support via the Elements module.