Discarding data for one question | XM Community
Skip to main content
Is there a way to prevent a specific question from being saved (though the respondent answered it)?



I'm saving this question's response as embedded data for the duration of the survey, using JavaScript. I'm purposefully not adding this to Survey Flow so that it is discarded. This embedded data is POSTed to a web service before the end of the survey.



To keep this response from ending up in the survey data, I'm clearing it using JavaScript. Is there another way?



(In this example, the response is the first text field of a form. The first line in the function sets the embedded data, and the second clears the text field before proceeding.)

~~~~

Qualtrics.SurveyEngine.addOnPageSubmit(function()

{

/*Place your JavaScript here to run when the page is submitted */

Qualtrics.SurveyEngine.setEmbeddedData('FirstNameEm', jQuery("#"+this.questionId+" input[type=text]").eq(0).val());

var res = jQuery("#"+this.questionId+" input[type=text]").eq(0).val("")

});

~~~~
Hi @tgrayguy,

I'm not sure what you dislike about your solution in case it works. However, if you want to have a text-entry box which value won't be stored in the survey data, you could define your own box in HTML. Just change question type to "Descriptive text", edit it in the HTML mode and and there an input tag. You can work with its value using JavaScript if you assign it an id and you can change its appearance using CSS.
Yes, it works, but I thought there might be a simpler way. And I think people might find it awkward that their input is visibly cleared before the survey proceeds.



I like your alternative solution; thanks for you help!

Leave a Reply