Phonenumber validation
Hi,
Can someone help me to validate a Phone number field.
I want to check the input for a validation of length 10. I really don't know how i can arrange that.
thanks in advance.
-
Hi Bas,
sure! The Regex (which is standard part of JavaScript) is what you need, it is actually not complicated at all.
Please take look at this thread:
There it is explained how to set up text field validation using Regex. You can validate anything that way.
The regex expression (rule) which you might want to use ("at least 10 numbers"), is the following. It tells the validator that the field should be contained only from numbers, and should be at least 10 and maximum 15 digits long:
^\d{10,15}$If you want to use international phone numbers in the format such a +49 123 456 - 789, you can use the following regex expression:
^\+(?:[0-9] ?){6,14}[0-9]$If you need a country specific formatting, you can easily google it, such the regex expressions can be easily found on the net.
Cheers,
Adis
0
Please sign in to leave a comment.
Comments
1 comment