[whatwg] Input type for phone numbers

Markus Ernst derernst at gmx.ch
Tue Mar 31 09:30:59 PDT 2009


Boris Zbarsky schrieb:
> Antti Koivisto wrote:
>> I'd like to propose a new <input> type attribute value for phone 
>> numbers  (<input type="phonenumber"> perhaps). The primary benefit 
>> would be to enable use of phone number specific input methods (for 
>> example a virtual keyboard) and pickers (for example a system address 
>> book). A useful minimal implementation could limit the allowed 
>> characters to those legal in phone numbers (+ * # and 0-9).
> 
> A brief look around shows the following characters also commonly used in 
> phone numbers as people actually type them in the US: ' ' (ascii space), 
> '.', '-', 'x' (this last in cases like "1-800-123-4567 x235").
> 
> This last case in particular is one I would suspect involves a good bit 
> of regional variability; I doubt the Latin lowercase 'x' is used 
> throughout the world to denote extensions.

There are more issues like this - vanity numbers with letters a-zA-Z 
seem to be popular in the USA, while they are marginal here in the 
German speaking countries. Also, the separation of phone numbers into 
blocks and the block separation character(s) are subject to regional 
differencies, and several formats might be considered as valid in the 
same region.

Here in Switzerland, these formats are quite common:
+41 (0)12 345 67 89
+41 12 345 67 89
012 345 67 89
012 345 6 345
In private use you find more variants, e.g.:
012-345'67'89
012/345'67'89
012 345/67/89

You will find other formats in other countries. I have no idea what 
people type in Japan or Sri Lanka.

So, while e-mail addresses have a strictly defined format, this does not 
apply to phone numbers. Internationalisation would be necessary to 
validate them, and still it would be a hard task, as complete sets of 
valid formats might not be available for every country.


More information about the whatwg mailing list