Default Selection in Highlight Question | XM Community
Skip to main content

Hey!

I want to show respondents a Highlight Question they already answered again, but also display them with the selection they made the first time to reconsider them. Is there a way to have a default category selection in a highlight question in Qualtrics? My hunch was to extract the first selection and have a JavaScript to highlight the selection again. My current JavaScript (below) is not working:

    var questionID = 'QID273';
    
     // Replace 'Option1', 'Option2', etc. with the values of the options you want to select by default
    var defaultOptions = "${q://QID39/ChoiceGroup/SelectedChoicesForAnswer/1}";
    
    // Get the question element
    var questionEl = this.getQuestionContainer();
    
    // Loop through each default option
    defaultOptions.forEach(function(optionValue) {
        // Find the checkbox corresponding to the default option
        var defaultOption = questionEl.querySelector('labelafor="' + questionID + '_' + optionValue + '"]');
        
        // If the default option exists, select it
        if (defaultOption) {
            defaultOption.click(); // Click the label to select the checkbox
        }
    });

 

Any help is greatly appreciated! Thanks in advance!

If we don’t want to store the first selection and final selection then we can simply follow this - keep the highlight question in a separate block. In the survey flow just duplicate the block and position it at the expected part of the survey. This will show the same question twice  but second time with selection of first time.


If we don’t want to store the first selection and final selection then we can simply follow this - keep the highlight question in a separate block. In the survey flow just duplicate the block and position it at the expected part of the survey. This will show the same question twice  but second time with selection of first time.

Thanks for the answer! Unfortunately, I want to record the first and final selection, as I am unsure, if people will change their selection.

Is there still a way to do this?


Hi @dylanpa22 you can create embedded data in the survey flow to capture first and final selection of a particular question.

‘Q1_first_selection’ embedded data will capture  the first selection with the pipe text of Q1 selected choice and when the block is displayed again and the respondent selects another answer choice,  ‘Q1_second_selection’ will capture the second selection.

 


Leave a Reply