Autocomplete rank order question | XM Community
Skip to main content

Hi all,

 

I was wondering if could please get help with the below.

For context, I have a question Q1 which is a multi select question asking why people want to go to TAFE. I then use the carry forward function to pipe in the answers that were selected in Q1 into Q2. Q2 is a rank order question using text boxes where respondents have to enter in a number (rank) for each of the reasons they go to TAFE.

If a respondent only selects one answer in Q1, then only one answer is carried forward into Q2. Is there a way so if a respondent only selects one answer in Q1, then it automatically enters the number 1 into the text box in Q2, and then proceeds them to the next question? I understand this might be possible using Javascript but I haven’t been able to get something that works.

 

Any assistance here would be greatly appreciated!

Thanks,

Christian

Try below JS in addOnReady function:

if(jQuery("#"+this.questionId+" .RankInput ").length==1){
jQuery("#"+this.questionId+" .RankInput ").val("1");
this.clickNextButton();
}

 


Try below JS in addOnReady function:

if(jQuery("#"+this.questionId+" .RankInput ").length==1){
jQuery("#"+this.questionId+" .RankInput ").val("1");
this.clickNextButton();
}

 

Thank you! Works like a charm!


Hi Shashi,

Thanks for providing the solution above!

I'd like to tweak the JS for a question where the statements are carried forward into a multi select question as opposed to a rank order with text box. Same logic applies, if only 1 statement is carried forward, then I would like some JS to automatically click the multi select checkbox and then proceed to the next question.

I have tried the below, but it doesn't appear to work.

if(jQuery("#"+this.questionId+" .RankInput ").length==1){
        jQuery("#"+this.questionId+" input type=checkbox]").click();
        this.clickNextButton();
    }

 

Any help would be greatly appreciated.

Thanks,
Christian


Leave a Reply