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

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:
http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html

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

Smylers

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