I want to add a custom validation to ensure 10 digits are entered in a entry box | XM Community
Skip to main content
Could someone provide the right regex string to input into the custom validation box to do this. The respondent should be forced to enter 10 digits, not less and not more
^[0-9]{10}$
!



Sorry, it doesn't seem to be working. I've pasted the screenshot - is this how it needs to be inputted in custom validation?
Yes, that correct, except why is there an And in front of it? Is there another condition? It works for me by itself. What happens when you enter a valid 10-digit number and click Next? What happens when you make an invalid entry and click Next?
So there are a couple of conditions in a multiline text entry type question, the last of which is the 10 digit validation.

It allows all entries, valid, invalid and doesn't throw up error and allows one to move to the next page



!
The regex works, so it is something you've done or not done.
@Swapnil it looks like you are trying to validate fields in a form. You might have better luck using the validation on each of the elements rather than building the validation on the whole question.



!



If you click on the Click here to edit forms field option you can get to the screen shot that I have above. Then use the drop downs to the far right to apply the validations you are trying to force in your above screenshot. Is Not Empty would work the same as Force Response. Phone number you have to choose a country for it to validate. If you have several countries then I would set this to Numeric instead of US Phone Number and over in the validation try using the code Tom gave you again but deleting out all of your other lines of validation.

Leave a Reply