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

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

From: Schalk Neethling <schalk@ossreleasefeed.com>
Date: Thu, 6 May 2010 16:13:37 +0200
Message-ID: <018501caed26$544aaa40$fcdffec0$@com>
Smylers,

I understand what you mean but, then I have to agree with Thomas that you
can then use an input of type username and use the pattern to validate the
email address.

Schalk

-----Original Message-----
From: whatwg-bounces@lists.whatwg.org
[mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Smylers
Sent: Thursday, May 06, 2010 3:18 PM
To: whatwg at lists.whatwg.org
Subject: Re: [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 07:13:37 UTC

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