Save last part of text entry question as new data field | XM Community
Skip to main content

Hi Everyone

Hope you're well.

If I asked someone to paste a URL into a text field, and I wanted to also save the last part of the URL into my survey results as a new data field (which would always be "/a number"), how would I do this?

Thanks :)

You can this JS to your test entry question:

Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var arr = jQuery("#"+this.questionId+" .InputText").val().match(/([^/]*$)/);
Qualtrics.SurveyEngine.setEmbeddedData("string",arr[0]);
});

 


Thanks @TomG 

I did test this but I can’t see any new data captured in my data and analysis. Do I also need to add a new embedded data field in my survey flow?

As much info as possible would help.

Thanks :)


Yes, if you want the embedded data field saved in your response data add it to the survey flow prior to the block with question.


Leave a Reply