How to record the number of times a prompt is displayed? | XM Community
Skip to main content

I am trying to record the number of times that the prompt that’s displayed if the respondent fails to answer a question pops up. I want to measure the number of times each prompt (for blank or unusual answer) is displayed for every screen.  Can this be done with custom code, or is this feature not available in Qualtrics?
Thx!

Hi there, I found a thread that I think will be helpful to you. In that, npetrov937 provides some JavaScript that will do what you are describing.
In your Survey Flow, create an Embedded Data Element at the top of the Flow and create an Embedded Data field called "errors_q_1". Set the value of this field to be "0".
Next, add the below JavaScript to the Onload section of the question for which you're trying to count the validation error message:
var question = $(this.questionId)
$(question).select('.ValidationError').each(function(error) {
  if (error.innerHTML != '') {
    var errors = parseInt(Qualtrics.SurveyEngine.getEmbeddedData("errors_q_1"))
    errors++;
    Qualtrics.SurveyEngine.setEmbeddedData("errors_q_1", errors);
  }
})
Repeat for each question where you're trying to count the validation error message, but update to "errors_q_2", "errors_q_3", etc. in both the Survey Flow and question JavaScript.


Leave a Reply