Building a Phone Number Input

Of all the form inputs that have been written over the years, the phone number input box stands out as one of the most deceptively complex. On the surface, it appears simple—everyone knows what a phone number is! Underneath the surface, things get more complicated. There are many wrong ways to build a phone number input. A form could expect a specific format of phone number, rejecting everything else, but fail to let the user know which format it expects. Should there be parentheses around the area code? What about the country code? Even the biggest fan of your software will run screaming to a competitor if the form insists on (entirely hidden) formatting rules as shown in the screenshot.

The other side of the coin ...

Get Build Reactive Websites with RxJS now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.