Problem: HTML validator: value of attribute “type” cannot be “email”

Posted by on Apr 26, 2011 in Tips, Troubleshooting

Problem: The HTML validator gives this error: value of attribute “type” cannot be “email”

This is because input type email isn’t in HTML4 specification. It’s a specification from HTML5, but the validator work’s on HTML4 standard and will show the error when validating forms with input type email.

Using input type=”email” for email addresses is better than using type=”text” because then users of (iPad/iPhone, Android) will have the correct keyboard come up for entering an email address. The keyboard will have the @ symbol and .com on it.

There will be no problems with any older browsers, they all treat type=”email” as type=”text” anyway.

So there is an advantage to using input type=”email” for email addresses, Mobile Accessibility. The only disadvantage is what the validator says. Because of the advantage of Mobile Accessibility, the validator can safely be ignored and users of smart phones will enjoy your site more.

In version 4.0 the setting was added to select field type: text or field type: email, if you select field type: text, then this validate error goes away. Field type: text will be the default for the email field in version 4.0+

See related:
Problem: Email field is styled differently than other fields

Do you need help?

Send us a Donation:

Donate to Mike Challis