Creating question with open text response box and with a secondary response option | XM Community
Skip to main content

Hello,
Thank you in advance for your help.
I'm trying to create a primarily open text response question (describe your gender) to which would be an open text response box, but also want radio / single multiple choice box to tick if participants 'do not want to answer.' I'm trying different combinations but can't seem to figure it out. I'm so rusty I'm pretty much brand new!
Thanks in advance,
Honor

Hi Honor ,
I think you need to use a Multiple Choice question and enable the "Allow text entry" option on the first choice to capture the open text response for gender. The second bubble choice could be "Prefer not to answer" with no text entry field attached.
I've shared a similar question I've used previously, below, for illustrative purposes. It's not set up the same way as you described your question, but it's kind of the same idea. In your example, the last option would be the first choice.
image.png


Thanks MatthewM,
You’re right, this is what I tried! It has worked and is looking good. We now want to create a limited text response (so people only have 20 characters to respond in, and cannot upload any images / weblinks). Is there a way to create this condition (I can only see text limitations for text boxes). Thanks in advance!
Honor


Is this new item you want to create part of the existing question, or a different question? If it's the former, I'm not sure how to do that in a Multiple Choice-Allow Text Entry item.
If this new item is an entirely separate question, then you may be able to set that type of restriction using Custom Validation with RegEx. I'm not familiar with RegEx, however, so I can't do much to help you with that.


Thanks MatthewM. Yes I was hoping to do this as part of the existing question - so the text would be limited on the open text response box.
The other way I tried was with an open text box (which I seem to be able to limit characters) but then wanted an additional “I don’t want to answer” box afterwards but I can’t seem to find away to add the additional box!
I’ve not heard of RegEx but I’ll look into it thanks.

Thanks again.


https://community.qualtrics.com/XMcommunity/discussion/comment/48214#Comment_48214You can add this JavaScript to your multiple choice question:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .InputText").attr("maxlength",20);
});


Thank you TomG! I will give this a try!
Final question (for now I think ... I'm realising just how little I know with an introduction to JavaScript!). Is it possible to stop people from uploading a weblink / image in this situation (with the opex text response in this case)? We have resolved how to minimise the text length (thank you TomG) but our ethics team has concerns about people uploading malicious text/images!
Thank you so much for your support!
Honor :-)


https://community.qualtrics.com/XMcommunity/discussion/comment/48229#Comment_48229If by 'malicious text/images' you mean an injection attack through the text input field, Qualtrics already prevents that. You can also further limit what can be entered/saved using Text Entry Validation or JavaScript (input or blur event handlers or the Qualtrics addOnPageSubmit() function).


Thanks TomG! Yes, I think their concern was someone uploading an image (e.g. something identifiable) or even suggesting a weblink (e.g. a link to an adult site) - so I suppose not something specifically an injection attack, but something that would compromise the researcher in some way perhaps. I'm afraid I don't know what you mean by the JavaScript (it seems to be more complicated when trying to do the multiple choice question with an open text box (e.g. write in your gender - which we want to limit to 20 characters and stop anyone putting images / weblinks) and a second box (i dont want to answer). I'm so sorry I'm a bit useless, so your guidance is most welcome!
best wishes and many thanks,
Honor :-)


https://community.qualtrics.com/XMcommunity/discussion/comment/48231#Comment_48231You don't have to worry about images - those can't be added to a text input field. Most urls won't fit in 20 characters and I don't know why a researcher would actually use a url if it were entered.
It sounds like you might want something that censors offensive words. I have a function that does that - you can contact me by private message if you are interested in purchase.
You can also contact me by private message if you need custom JS (e.g., limit input to letters and spaces only).


Leave a Reply