Cognito-forms – Allow only numbers in Cognito Form phone field

cognito-forms

In a Cognito Form, the phone field seems to accept letters as well as digits. I have used the number field and set it to integer but it still takes values like "9,890,099". How can I set it to only allow or accept numbers?

Best Answer

I am a developer for Cognito Forms.

When using a phone field set to the US, your phone number will look like a line of numbers until you click out of the field.

enter image description here

Then field will then auto verify that all characters are numbers and that 10 characters have been added.

enter image description here

If you have fewer then 10 characters or have a non-numeric character you will receive an error message. This will only happen when the field is set to "US".

enter image description here

For phone fields set to international we do not have validation. This is because of the wide variation between phone numbers in difference countries. We are considering ways to incorporate validation for this, like using Google's phone number library.