This is a variation on the brain-damaged credit card number input field (where they couldn't be bothered to add one line of code to filter out spaces, but go to the effort to document this limitation -- or not) that you all know and hate.

This time it's a phone number. The difference is that whereas credit card numbers only contain spaces for non-digits, phone numbers are written (at least in the US, at least by people who aren't trying to be avante garde dorks by deliberately using bogus formats) as (123) 456-7890.

This field was annotated with the message "Please do not use dashes". Very well, then. I enter "123 456 7890" (after deleting the hyphen I initially forgot to omit) and submit.

I get the error "Please enter a valid phone number using the following format: 5551234."

Wait, what?  I can't use an area code?  WTF?

Oh. Obviously, the reason it asks me not to use dashes is because it can't handle dashes *or spaces*.

And apparently the error message was lifted from an older, pre-area- code program that was written in the 1950s. Although I'm not sure how they got Apache to talk to perl, since CGI hadn't been invented yet.

Josh

P.S. Adding '$num =~ s/[() -]//g' before the validation would be prohibitively invasive and costly. Of course, gratuitously converting my email address to all caps (in violation of every version of the standard) is no problem.



Reply via email to