W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2010

[whatwg] RFC: <input type="username">

From: Smylers <Smylers@stripey.com>
Date: Thu, 6 May 2010 14:18:24 +0100
Message-ID: <20100506131824.GE7644@stripey.com>
Schalk Neethling writes:

> if your username field will be in the form of an email address, then
> simply use type=username with a pattern to facilitate email
> validation.

Surely a major reason for having standard validation types is so web
developers don't need to come up with patterns for these common things?

It also avoids lots of different authors coming up with something
different, and not getting it right. The validation needed to accurately
match a valid e-mail address is surprisingly convoluted -- see for
example the regular expression on this page:

> Not sure if that is really even needed at that point anyway because
> you are not really concerned over a well formed email address.  If
> that was a problem, it would have been detected during registration.

Sure, you aren't concerned that a user's correct username might not be a
valid e-mail address.

But if a user tries to submit something that isn't a syntactically
correct e-mail address, then he must have mis-typed his username.  Using
type=email allows the browser to alert him to this, so he can fix it.
Without that, he has to wait for server-side validation.

Received on Thursday, 6 May 2010 06:18:24 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:23 UTC