Save last part of text entry question as new data field | XM Community
Question

Save last part of text entry question as new data field

  • 27 January 2024
  • 3 replies
  • 17 views

Userlevel 6
Badge +5

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 :)


3 replies

Userlevel 7
Badge +27

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]);
});

 

Userlevel 6
Badge +5

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 :)

Userlevel 7
Badge +27

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