"Please enter a valid phone number" message is unhelpful
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Software Center Agent |
Triaged
|
Medium
|
Unassigned |
Bug Description
I'm trying to fill out my details in:
https:/
I input my phone number in this format: +1-123-456-7890
After filling out the rest of the details and clicking "Submit", the phone number field got flagged with a "Please enter a valid phone number" message. But it doesn't tell me what the expected format is, so I'm left guessing. Hm, maybe it's the + sign at the beginning:
123-456-7890
No dice, same message. Eventually I found that what it wants is only the digits, so the correct input was:
11234567890
It would be easier if the message explained the expected format ("Please enter a valid phone number consisting of digits only"). It would be even better if the field was more forgiving and automatically discarded unwanted input up to a point (e.g. silently remove space, + and - but complain if any other characters or letters are present). And given the multitude of valid phone number formats, I'd definitely put this message there all the time, otherwise it's almost guaranteed that everybody's first attempt at guessing the format will fail.
Changed in software-center-agent: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Ha, looking at the code, the phone number is validated with this regex:
phone_digits_re = re.compile( r'^\+?( \d|\ |\.|\(\d+\))*$')
so this would be valid and preserves all the country and area code information:
+1 (123) 456 7890
still, without any indication that spaces, parentheses and + are valid but hyphens are not, it's a bit hard to guess.