[whatwg] <input type=tel> validation, and a small set of typos
Tab Atkins Jr.
jackalmage at gmail.com
Mon Jul 20 13:11:10 PDT 2009
On Mon, Jul 20, 2009 at 2:47 PM, Peter Kasting<pkasting at google.com> wrote:
> Two unrelated comments.
> First, it seems a bit odd to me that <input type=email> and <input type=url>
> are validated (for typeMismatch problems) but <input type=tel> isn't. I
> know it's prohibitively difficult to perfectly validate telephone number
> formats given the variety around the world, but it's also prohibitively
> difficult to validate email addresses per the relevant RFC, which is why
> HTML5 specs a much simpler algorithm that at least rejects obviously bad
> input.
>
> It seems like perhaps <input type=tel> could set typeMismatch if the input
> contained no numeric digits at all, or maybe if it contained characters
> outside 0-9, +, -, (, ), ' ', ...? Maybe the level of "validation" provided
> by these proposals is so low that it's not worth doing, though.
You got it. While emails officially have a very complex format, in
practice they follow a fairly simple, restricted format that can be
usefully validated.
Telephone numbers, on the other hand, differ wildly across the globs,
and you can't just identify a restricted subset that 'most' fall into.
Even if you could identify a sane subset of validation that you could
apply widely, it would be weak enough to be worth basically nil in
terms of actually ensuring that you've received a valid telephone
number.
~TJ
More information about the whatwg
mailing list