For a complete sample file, scroll to the bottom of the guide

  1. Once you have completed setting up your survey choose which question blocks you need to add validation too.
  2. Click on the ‘gear’ icon on the left side of your question block:
  3. You will then see several options but the one we want is ‘Add JavaScript…’ as shown below:
  4. When the JavaScript screen pops up click on the option “Full Screen” in the bottom left corner to make it easier.
  5. The screen should be pre-populated with the following:
  6. We will be placing our code in the ‘addOnReady’ function, starting with the following section of code:

    This section of code will allow us to use a different version of jQuery and jQueryUi, which allows the autocomplete/ajax code to work on the survey, as well as:

    • Create the variables needed for the phone methods
    • It will set the variable for your Kleber RequestKey
    • A label that will display to the client if the response was valid or invalid
  7. Next, we will add the code that calls the Kleber platform to validate the first phone number field:
    • Here we make it so that when the phone number field loses focus, it will attempt to validate the phone number
    • If the call is sucessful we output the StatusCode for this sample but other fields are avilable
    • If we had bsuiness rules to apply for when a phone number is valid/invalid we would call them here
  8. We then repeat the previous step another 2 times for the other 2 phone fields and make sure that all functions have their closing brackets in the correct spot

Congratulations you have just integrated Kleber Phone Validation into your Qualtrics survey.

Please look at some of the other step-by-step guides if you wish to add additional validation.

Complete Sample code