Pipe text from input text to non-input text keeping enters (newlines) in a timed question | XM Community
Skip to main content

Hi!

I am building an experiment where the participant has to write a text. In between writing the text i want them to answer a couple of questions, after which i want them to continue writing in the same text they were writing in before. They have 4 times 5 minutes of writing before they are sent to the question portion. I also would like them to be able to see the text they have written here, without being able to edit it.

My problem is that when i pipe the text they have written to a text field, the “enters” are deleted.

I have used the method from this post to take my text from the first textinput to the second and third...etc. And this works perfectly! (tldr: i created an embedded datafield in the flow after the first text input page with as value the textinput, and used default choices to pipe the embedded data to the new input textbox)

But when I pipe the embedded data to a text/graphic question using “ ${e://Field/sometext}” it deletes the enters.

I have tried the method in this post

But my participants don’t push a next button, as the question advances based on a timer on the page (after 300 seconds), so I don't seem to get it to work.

Can you help me fix this?

Thank you!

Rieke

You can use this JS in your text entry question to save the line breaks in an ED:

Qualtrics.SurveyEngine.addOnReady(function () {
const textBox = this.questionContainer.querySelector(".InputText");
textBox.oninput = function (a) {
const textEntry = a.target.value.replaceAll("\n", "<br>");
Qualtrics.SurveyEngine.setEmbeddedData("textEntry", textEntry);
};
});

You can then use the ED textEntry at a later stage.

Here’s a demo: https://iima.au1.qualtrics.com/jfe/preview/previewId/00a1841e-33a5-49ae-a9c5-6934da853af4/SV_8HBDY4VRJnFn40J/BL_56IK5HWNce2T4cS?Q_SurveyVersionID=current


Thank you!
 

I had found that solution indeed. What was my problem with that one is that the EmbeddedData you create in the JS, does not appear when piping it through the qualtrics interface.

I thought i was doing it wrong but now i see i just had to type the name of the new embedded data manually when piping it. thus just type “ ${e://Field/textEntry} “

 


Leave a Reply