Validation criteria

Hi @Osama ,
Yes, to allow for 10 digits, you need to change the question type to “text”.
And then, as @Suman has already said, you need to have a “regex” in the validation criteria (or “constraint” column, if you’re creating the form in Excel).

For example, you might want to collect 10 digits to collect a phone number.

If you wanted to collect a 10-digit phone number (so, you want to collect 10 digits, not alphabet letters), then your validation criteria/constraint would be this:
regex(., '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]')

If you want to make sure the first digit they enter is a “zero”, then you could do this:
regex(., '[0][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]')

If some phone numbers have 9 digits, and some have 10 (like, in some countries, if you’re close to the border, then some people have phone numbers from a different country, so the length of numbers might vary), then you can put a validation like this:
regex(., '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]?')

Those are some options that I hope will help you!
Janna

3 Likes