"Please enter a valid phone number" message is unhelpful

Bug #1504333 reported by Daniel Manrique
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Software Center Agent
Triaged
Medium
Unassigned

Bug Description

I'm trying to fill out my details in:

https://myapps.developer.ubuntu.com/dev/account/

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
Revision history for this message
Daniel Manrique (roadmr) wrote :

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.

Revision history for this message
Stephen Stewart (stephen-stewart) wrote :

Also the client should validate this field and report problems first, so we need to:

1) fix the regex
2) add help_test explaining the expected format
3) add more information about expected format to server side error message
4) validate on the client side
5) provide clear client side error messages for any failures on the client side, as per 3

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.