I am new to qualtrics and am creating a survey for a clinical research trial.
I have a multiple choice question with 3 choices. Only one answer is allowed. Each choice has text entry allowed. If a participant selects one answer and enters text in the box, then they change their mind and make another selection, how do I clear the text from the box they first selected and entered text into?
I really look forward to getting advice from you experts. I have spent hours googling this to no avail.
Hi!
I think you can solve this by adding a Custom Validation to your question.
That way you can have several different AND/OR statements for example:
Validation will pass if the following condition is met:
Q1 - Times per WEEK is selected
AND Q1 (text area) is not blank.
OR
Q2 - Times per MONTH is selected
AND Q2 (text area) is not blank
etc.
I haven't tried it myself but I think you might be able to solve it like this.
I BELIEVE IN YOU! :)
All the best
-M
I believe the most respondent friendly solution is to use JavaScript to clear the text entry boxes of the unselected choices when a new choice is selected. Use a click event handler to do this.
https://community.qualtrics.com/XMcommunity/discussion/comment/43326#Comment_43326I love that "use Java Script" is the most common solution from all you Wizards
For me that is a total zero with Java Script always needs to find other solutions. Also makes me realize I perhaps should get some Java Scripting under my belt to cover more grounds for the future.
Thank you for your suggestions TomG and MattiasM
I got the following code from Rudi that works perfectly - thanks again Rudi.
*******the below code deletes the other texts of unselected choices*******
you need to adopt the QID to your needs and also the numbers in your condition and in the get elementById function
Qualtrics.SurveyEngine.addOnReady(function()
{
this.questionclick = function(event,element){
let selectedChoices = this.getSelectedChoices();
if(selectedChoices.include('1') === false){
document.getElementById("QR~QID4~1~TEXT").value=''
}
if(selectedChoices.include('2') === false){
document.getElementById("QR~QID4~2~TEXT").value=''
}
if(selectedChoices.include('3') === false){
document.getElementById("QR~QID4~3~TEXT").value=''
}
}
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.