How do I make sure that a phone number field has at least 7 characters and no more than 10?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

For example - I have a field on my form that is a phone number field.  However, it is possible for someone to put too few or too many characters in the field.

I love that the field already knows how to format the input if there are either 7 or 10 characters - I just need it to validate that there is either 7 or 10 characters that have been entered! 

Thanks in advance,

Devona

Photo of Devona

Devona

  • 20 Points

Posted 3 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,944 Points 50k badge 2x thumb
Yu could have a warning field like this

var number characters = Length([Phone Number]);

If($characters <> 8 and $characters<>14 and $characters<>0,"<font color=red>Invalid Phone Number")

The Length function counts the extra formatting characters of the (212) 555-1234