Larger text box in Side-by-side question in New Survey Taking Experience
Hi,
I have a side-by-side question, with in the first columns a 4-bullet-point question, and in the last column an open text field.
I am using the New survey taking experience.
I would like to make the open text field larger (both wider and higher). On desktop ànd on mobile.
I also think to make it possible to make the text box larger, that also the wole survey width on the screen will need to be a it wider too.
I have been looking to other topics on the community to css and javascript examples, but they don’t seem to be working on the side-by-side question and/or the new survey taking experience.
Can anyone help me with the right code (either css or javascript) to make this possible?
Thanks!
Page 1 / 1
Hi, you can use the below CSS to make the SBS question take up the whole screen and make the text input take up 100% of the column width:
While you could make the text input higher by adjusting the line-height with CSS, this won't make the text wrap, which I think is what you want. To do that, the <input type=”text”> elements needs to be replaced with <textarea> elements. Since Simple/NSTE layout uses React and I don't think SBS works with setChoiceValue(), the method mentioned in this thread can be used to set values to the text-inputs so that Qualtrics actually records them. Also, the elements change a bit between desktop and mobile, so some lines were added to use name (desktop) or id (mobile) depending on which is available. Try updating the SBS question's JavaScript with the below:
Qualtrics.SurveyEngine.addOnload(function() { /*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function() { /*Place your JavaScript here to run when the page is fully displayed*/ const inputs = this.getQuestionContainer().querySelectorAll('input.text-input');
inputs.forEach(input => { // Use the input's name or id as a unique reference const ref = input.name || input.id; if (!ref) return;
// Assign the reference as the input's id if not already set if (!input.id) { input.id = ref; }
// Hide the original input input.style.display = 'none';
And I should add, I would think that at some point changing the text box size to "Essay" would make this text input a textarea, which is how it works for the other layouts, but not yet for the NSTE.
Thank you so much Tom 😀 Works perfectly 👍
I did have to make the “question text” of my freetext box larger. (the “click to write column 2” part).
The “question text” of my 4 MC options is quite large, and so with the 100% setting, the MC options were taking up the largest part of the screen, while the text box then only got a tiny fraction.
I tried setting the CSS part for the MC to a lower percentage but that didn’t do much,
but then by making my “question text” larger I could make the box the size that I wanted.