Web Service to validate an input - only proceed when a correct value is entered | XM Community
Skip to main content

Hi,
I have an input field in which a code needs to be entered. This question is in the block "Code Input".
Via a Web Service in the survey flow, we need to validate in another system if this is a valid code.
In case the code is not valid, the survey should not proceed to the next question block, but show an error.
Making the webservice call works, but we're stuck on how to limit the survey from proceeding.

We tried making the web service set an embedded value "Validated" which returns the value when the web service succeeded, and remains blank when the web service failed (so the entered code was not valid). Then adding a branch "If Validated Is Empty" and then put again the same question block "Code Input" in that branch, creating a loop.
So the survey flow is:

  • Block Code Input

  • Block Web Service

  • Branch: If "validated" is empty

-> Block Code Input
  • Branch: if "Validated" is not empty

-> Block Rest of the questions

However, when you are in that "validated is empty" branch, the web service does not execute a second time, because you're in the branch now, and the web service is before that... and adding 10-something nested branches incl webservice doesnt seem like a good solution here...
Anyone who has an idea how to properly implement such a scenario, to validate the input of a Text Entry question with a web service and not allowing to proceed with the survey if the input is incorrect?

Hide the qualtrics Next button and create a custom button. On click of this custom button use jquery ajax to call the external web service. Create a counter to track the count of request sent. If code validated set the embedded data and click qualtrics next button else if counter reaches 10 and still not validated then do not set the ED. After this in survey you have already set the required branch logic.


Thanks rondev , but if you put the web service in javascript instead of in the survey flow, won't you be able to read the credentials used to call the webservice with F12?


Ohhk then for security point of view you can disable the right click and F12 functionality on form and obfuscate the JS code.


Leave a Reply