Best way to confirm (re-enter) phone number | XM Community
Skip to main content

I'm asking each respondent for their phone number. To make sure, it doesn't contain any typos, I've added another question asking them to re-enter it. The two questions are separated by a page break, which is necessary to use piped text in the confirmation question. The confirmation question checks whether the two phone numbers are the same and if not, you cannot continue to the end of the survey. Since my survey does not have a back button, if a respondent did enter a typo in the first question, they might get stuck at the confirmation and never complete the survey.
What is the best way to confirm their phone number? Could you check whether two phone numbers are the same within the same question using some custom code? (this would be my preferred option, if possible) Could you jump to the end of the survey once the phone number has been entered wrongly three times?
I'd strongly prefer not to use a back button.
In case it makes any difference, the first question validates that the format of the phone number is correct using a regex.

https://community.qualtrics.com/XMcommunity/discussion/19568/best-way-to-confirm-re-enter-phone-numberYou can do this in one form field question:

  1. Phone is the first field, Phone confirm is the second field.

  2. Change validation of both fields to the applicable phone number type (e.g. US Phone Number)

  3. Get the piped value of the second field (temporarily pipe it into the question text then copy it)

  4. Add custom validation to the question. The condition is the first field should equal the piped value of the second field (paste from copy in (3) above.

  5. Choose or create an applicable validation error message.


Thanks for the instructions! Could you elaborate on point 3? I don't know how to "temporarily pipe it into the question text then copy it". I was under the impression that you would have to add a page break or a new section to access piped text.


https://community.qualtrics.com/XMcommunity/discussion/comment/43525#Comment_43525Click on the question text and place the cursor where you want pipe. Click Piped text... and choose the current question and Confirm phone (the second field). Now copy the pipe (from ${ to }) and paste it into the JS.


Awesome, it's working now! Thank you so much! One last small thing (sorry for going off-topic):
Is there a way to specify the error message depending on whether the phone number format validation or the re-enter validation was violated? I.e. whether somebody entered a number in an invalid format or whether somebody simply did not re-enter the same number in field 2 as in field 1?


https://community.qualtrics.com/XMcommunity/discussion/comment/43528#Comment_43528They are different error messages and they display in different places. The invalid phone number would show up just under the input box for each number and the text isn't changeable. The don't match message will show at the top and you can create your own error message.


I see what you mean. My problem is that the phone number validation should be for an Indonesian phone number which is not one of the content validation options. Apart from these 7 options (Email Address, Phone Number, US State, Postal Code, Date, Number, Text-only (Non-numeric)), can I validate the content of the form fields, ideally using a regex?


https://community.qualtrics.com/XMcommunity/discussion/comment/43539#Comment_43539In that case, you'll have to validate the phone number (you only need to do one) in custom validation with regex as an AND to the matching numbers condition. Unfortunately, you'll need to make one error message do double duty.


I see. That's not ideal but it'll have to do. Thanks so much :)


Leave a Reply