TheRosettaFoundation / SOLAS-Match

Self-managed translation project interface
www.TheRosettaFoundation.org
GNU Lesser General Public License v3.0
12 stars 8 forks source link

Edit Profile, adding phone numbers. #568

Open markcummins opened 11 years ago

markcummins commented 11 years ago

When editing my profile details, I am allowed to add text to the Mobile and Business number fields. Only numbers should be allowed in these input boxes.

manuelh commented 11 years ago

This was to support anyone writing phone numbers with the plus (+) sign for international calls.

For example, a German phone number could be written with the country prefix being 0049 or +49

To prevent people entering random text, I would probably suggest a regex to check the validity.

More info on regex here: http://stackoverflow.com/questions/2113908/what-regular-expression-will-match-valid-international-phone-numbers

Example from Answer # 2 :

\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|
2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|
4[987654310]|3[9643210]|2[70]|7|1)\d{1,14}$