Auto select from multiple select question | XM Community
Skip to main content

 

Could someone help me with my JavaScript code?

In question QID4, I have a gender selection question. If someone chooses 'Prefer not to say,' I'd like to automatically select '1. Terminate on the next page.

 

I wrote JavaScript code, but no matter which option I choose in QID4, it always auto selects option 2, 'Continue.

Qualtrics.SurveyEngine.addOnload(function() {
    var gender = "${q://QID4/ChoiceGroup/SelectedChoices}";

    if (gender === "4") {
        this.setChoiceValueByRecodeValue(1, true);
    } else {
        this.setChoiceValueByRecodeValue(2, true);
    }
});

@hachiware10  just change (gender === "4") to (gender == "Prefer not to say") also put a pagebrake between 2 question


Leave a Reply