Default choices for a multiple choice question with multiple answers using embedded data | XM Community
Question

Default choices for a multiple choice question with multiple answers using embedded data

  • 6 March 2024
  • 1 reply
  • 16 views

Badge

How can I setup a multiple choice question where multiple answers are possible and default choices are selected based on the contact list? I also want to be able to display all the possible choices and only have the relevant choices based on the contact list.

 


1 reply

Badge

Hi @Hilaryacd ,

One possible solution for this can be using contact list and JS.

First - The contact list should be assigned before the multiple choice question block and Capture those option which you want to be selected as default choices in to embedded data.
Second - If they are non numeric, assigned them numeric values based on the recode values of multiple choice question.
Third - Select “Allow multiple answers”. Now, Go into JS of multiple choice question and put the below code which will work as default selected choices. 
Fourth - The below example is to default select the first option of a multiple choice question. You can use a for loop for multiple selections.

JS
/*Place your JavaScript here to run when the page is fully displayed*/
    var i = 1
    var val = i;
    
    if( val == 1){
    this.setChoiceValueByRecodeValue(val,true) 
    }

Leave a Reply