HELP! Respondent having an issue with the survey... | XM Community
Skip to main content

We set up a 103 question survey and the respondent is getting this response when trying to click forward "You have added text into a unselected answer choice. Please select the answer choice or remove the text" and he cannot move forward in the survey!

I am going to make the assumption that he did not select the button next to the "other" with the text box in the multiple choice. But before I make that assumption, I wasn't sure if anyone had this issue?

Thank you!!!!

Yes, this is known behaviour. If they entered some text in other text entry box then they have to select that other option. But if they want to select some other choice then they have to make sure the text entry box is empty.


This should solve your problem. Basically it clears the text box, if any other choice is selected:
Qualtrics.SurveyEngine.addOnReady(function(){


    const qid = this.questionId;
    n_choices = Qualtrics.SurveyEngine.registrygqid].getChoices().length;
    // Set this according to where you are placing your text entry box
    //This refers to the last choice, -1 to the second last choice etc....
    text_choice = n_choices;


    this.questionclick = function(event,element){
        var selected_choice = element.id.split('~'))2];
        if(selected_choice !=text_choice)
        {
            document.querySelector("#QR\\\\~" + qid + "\\\\~" + text_choice + "\\\\~TEXT").value = "";
        }
    }


});


This isn't working for me, but I'm not sure I'm understanding the instructions completely. Is it possible to post screenshots or an example of what specifically you're referring to when you say, "Set this according to where you are placing your text entry box" and "This refers to the last choice, -1 to the second last choice etc..."
For me, the text entry culprit is next to last in the list of carry-forward items, but will always be displayed last because the question isn't displayed if that option ("None") is selected. I assumed you were referring to getChoices(), so I tried leaving that empty (last choice) and I tried getChoices(-1) (next to last choice). Neither works for me.
I'm about to abandon carry-forward for option-level display logic since we haven't started data collection, but that's probably not an option for the original poster.


text_choice = n_choices; // If text entry is the last choice
text_choice = n_choices - 1; // If text entry is the second last choice
text_choice = n_choices - 2; // If text entry is the third last choice
text_choice = n_choices - 3; // If text entry is the fourth last choice
I highly doubt making this change will work for you since you are using carry forward choices.


I'm having the same issue, but the fix is not working... could this be because I'm using an institutional account?
The fix works on the question preview (the preview that only shows the one question you are working on), but not on the entire survey preview or when I publish it...
I have no carry on logic on the survey.


BusyBee100
Try this:
Qualtrics.SurveyEngine.addOnReady(function () {
    const qc = this.questionContainer,
        ip = qc.querySelector(".InputText");


    this.questionclick = function () {
        setTimeout(() => {
            ip.ancestors().forEach((item) => {
                if (item.className.includes("Selection")) {
                    let ch = item.querySelector(".q-radio, .q-checkbox");
                    if (!ch.className.includes("checked")) ip.clear();
                }
            });
        }, 50);
    };
});


Yes!!! It worked. Thank you!


Hi BusyBee100
I thought I had found my solution when I found your script but unfortunately it doesn't work for me.
I have a multiple choice question with 3 choices. Each choice has a text box. When someone selects a choice, adds something in the text box then changes their mind and selects another choice and adds text, the text from the 1st selection is still visible.
I would like the text to clear from a previous selection when another selection is made.
Thank you in advance for your help.


Leave a Reply