# Discussions

View Only

## How do I make sure that the phone number entered in my form is 10 digits and throw an error if it is wrong?

• #### 1.  How do I make sure that the phone number entered in my form is 10 digits and throw an error if it is wrong?

Posted 04-12-2018 19:11
How do I make sure that the phone number entered in my form is 10 digits and throw an error if it is wrong?

• #### 2.  RE: How do I make sure that the phone number entered in my form is 10 digits and throw an error if it is wrong?

Posted 04-12-2018 19:14
You can use a formula field to 'count' the number of digits in the field, and then use a form rule that will show a pop-up if it is not equal to 10.

• #### 3.  RE: How do I make sure that the phone number entered in my form is 10 digits and throw an error if it is wrong?

Posted 04-12-2018 19:14

You can use the Length() function like so in a formula check box field.

if(

length([phone number])<10,true,false

)

I'm not sure if the function would consider the counting of hyphens. Experiment around with it.

• #### 4.  RE: How do I make sure that the phone number entered in my form is 10 digits and throw an error if it is wrong?

Posted 04-12-2018 19:22
I tried doing that, it does not work. Can you tell me what is the field type that you select for formula? Phone number is of field type PHONE.

• #### 5.  RE: How do I make sure that the phone number entered in my form is 10 digits and throw an error if it is wrong?

Posted 04-12-2018 19:30

Length will be 14 for a phone data type. It will be in this format (000) 000-0000.

You can make just a formula number field like this:

[formula number field]

length([phone number])

You will likely get 14 as that is what a normal 10 digit phone number will return, 14 characters total.

Then use a form rule to see if this number is at least 14.

• #### 6.  RE: How do I make sure that the phone number entered in my form is 10 digits and throw an error if it is wrong?

Posted 04-12-2018 19:53
Got it, thanks. It worked, I was calculating on the assumption length =10.