Hello everyone im currently working on a survey where i want to put text entry in the middle of the sentences.
Therefore my questions would look like this
'' I am [Text Entry] years old '' or '' Im working in a company named [Text Entry] since [Text entry]''
Is it possible ?
I saw a JS Script for that here https://psrc.princeton.edu/sites/psrc/files/html_tips_tricks.pdf (i adapted it to my questions) but it didnt worked.
Any tips on how doing it ?
Thanks a lot :)
Allowing Text entry in the middle of a sentence
Best answer by ahmedA
The solutions will be different for one input and more than one. This is due to the restrictions imposed by Qualtrics in displaying text entry questions, so below is the general solution.
Use a descriptive text type question and edit its HTML to create the required fields. A text entry box is part of the input family of HTML5. Read about the various kinds here as you'll need it to understand and customize the code to your needs. You can also add an id to each element to extract its value.
So finally you should have something like this:
I'm working in a company named since
Once you've defined your input. You can use JS to store the value in embedded data variables with this code:
Qualtrics.SurveyEngine.addOnReady(function () {
let inputs = this.questionContainer.querySelectorAll("input");
document.querySelector("#NextButton").onclick = function () {
inputs.forEach((item) => {
Qualtrics.SurveyEngine.setEmbeddedData(item.id, item.value);
});
};
});
Based on the HTML above, you will have two embedded variables
companyand
dojwhich will have the values corresponding to the ids.
For sizing and other restrictions, refer to the pages above or use google to find the appropriate properties.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
