Re: Phone Number Validation in Forms

Anonymous
Not applicable

Phone Number Validation in Forms

Hi all, 

I noticed some leads coming in with invalid phone numbers, only 8 digits long. 

Just tested this and confirmed my form will accept 12345678 as a phone number, although it won't accept 1234567. 

I understood that the default "Phone" field (which has a type of "Phone") should ensure proper validation, but it seems to not be the case. 

How can I make this field require at least 10 digits? 

I'm not looking for super-fancy formatting or anything, just ensure it has a minimum of 10 digits so the number is ostensibly valid. 

Thanks!
Tags (1)
8 REPLIES 8
Alok_Ramsisaria
Level 10

Re: Phone Number Validation in Forms

Hi Justin,

You can use Mask Input for this purpose. Change the field type to text and enable Mask input. Use "9" to mean any number, "a "to mean any letter and * to be either one. In your case, for the field to require 10 digits, you can use 9999999999.

0EM50000000RcBk.jpg

For more, refer this help article to Apply Input Masking to a field in a form.

Hope this helps!
Josh_Hill13
Level 10 - Champion Alumni

Re: Phone Number Validation in Forms

Just be careful here because international #s won't validate unless you have that * on either end.
Anonymous
Not applicable

Re: Phone Number Validation in Forms

Hi guys, 

Thanks for the feedback -- didn't know about the Mask Input functionality. 

Problem is, when I try to do this I get an error message: 

Only custom fields can change type
 

Is it really possible that there is no way to validate the default Phone field that is in SFDC? It would seem nuts to have to create a new custom phone field and re-organize my entire CRM instance to get a properly validated phone field but that would seem the only way (hope I'm wrong!)

Thoughts?

Thanks again. 
Anonymous
Not applicable

Re: Phone Number Validation in Forms

Ah I just checked the article you posted and I think I understand now. 

You are talking about changing the field type at the form level -- I thought you meant to change the type in the field administration section. My bad.  

So next problem is this is a 1.0 form (not 2.0). Is the masking functionality only available in Forms 2.0? I can't seem to find it in the legacy forms editor. 

I haven't transitioned these to Forms 2.0 yet since they have some limitations with my CMS (wordpress). 
Anonymous
Not applicable

Re: Phone Number Validation in Forms

So will masking only work with US to ensure US based phone #s?

Is there some way to do a conditional field where a (xxx) xxx-xxxx shows up if United States is chosen as a country? Otherwise, show the normal #format (or better yet, show an the phone format based on country).
Angela_Ruggeri1
Level 2

Re: Phone Number Validation in Forms

Has anyone found this out?

Casey_Grimes
Level 10

Re: Phone Number Validation in Forms

Hi Angela,

This would be pretty easy to do with a little bit of JS knowledge (just combine a listener for whatever country's chosen and something a la jQuery Mask Plugin.) However, I don't think there's anything that does it out of the box, no.

Grégoire_Miche2
Level 10

Re: Phone Number Validation in Forms

Hi Angela,

vote here:

-Greg