Phone Number Validations

34 Views Asked by At

Suppose you're making a Sign-Up Form which takes your phone number as a detail with respect to all the other details . So let's say , I added some validations, say for example :

1. Phone number length should not be greater than 10

2. User should not be allowed to write any special characters too

After giving the basic validation checks, I went on to check if everything's working fine or not and suddenly I type 1111111111 in my box.

Now, lets say you're developing it for India, now you know this is not a valid phone number or a user adding 1110001231 does not make any sense.

So, is it good to give validation checks to check if the number provided is correct or not (assuming you don't have an OTP page to validate that number) or is it over-engineering stuffs ?

And if you make it for one country, say India, how would one approach to scale it for different countries ?

I went on to some webapps such as Zomato, Swiggy which had only basic or no validations as such , but then Flipkart or Amazon return an error .

Since, I am a fresher I would like to know what people think of it in the industry. Does basic validation satisfy or validating if its a correct number ( no OTP , etc) from the frontend a better user experience

I tried only having basic validations . When I tried simulating it to a friend (assuming he is the client), he asked me why was I letting the user type 1111111111 and let him sign up.

We had a discussion but was time bounded and hence would just like to know the perspective of different developers as in what do they tend to follow ?

0

There are 0 best solutions below