Prevent the number '1' from being the first number in a US Phone number?

I have a US phone number field that displays as (xxx) xxx-xxxx in the input field. I’m finding that some users enter their number with the ‘1’ first. So instead of the value being stored as (555) 555-5555 it is being saved as (155) 555-5555 (with the last number being cutoff).

Has anyone else run into this? Is there a conditional statement that can remove the ‘1’ if it is the first number entered?

Hi there, @doug4… if it was me, I would probably add some helper text under the field that tells the user not to enter the 1. You can also add a condition on the input, on a submit button, or on some sort of alert that says when the phone input field’s value truncated to 1 character is 1, do something that stops the user from moving forward and makes it clear to them what the issue is.

Hope this helps.


1 Like

Thank you mikeloc those are both good suggestions and should be easy to implement.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.