Auto-Code Response for a Carry Forward Question from a Multiple Answer Multiple Choice Question

Karlo247Karlo247 Westlake VillageCommunity Member - Trial User Qubie ✭

Auto-Code Response for a Carry Forward Question from a Multiple Answer Multiple Choice Question

Hi All,

A little new here to the platform. I contacted Qualtrics support to see if I can apply some custom code for a Carry Forward question, but they mentioned this might require some javascript to show correctly.

So the initial question is a Multiple Answer Multiple Choice question. I used the Carry Forward Choices to populate the next question (so if the survey taker selects 5 out of the 10 responses in Q1, they then see those 5 responses in the Carry Forward question, which is a Single Answer Multiple Choice question, and they select one answer from those 5 responses). 2 of those responses are exclusive and if selected, I have Display logic to not show the Carry Forward question. I also have Display logic to only show the Carry Forward question IF more than one response is selected from the Multiple Answer Multiple Choice question.

What I want to do is if only one response is selected in the Multiple Answer Multiple Choice question, I basically want to auto-populate the Carry Forward question with that one response, and NOT show the Carry Forward question. Is there a possible solution here using javascript? I believe I have already solved for skipping the question if they selected one of the exclusive options (e.g., Don't know) and displaying it if there is more than one response selected from the original question, but trying to solve for this auto-population if one response is selected.


Best Answers

  • sranesrane Chicago Qubie ✭
    Accepted Answer

    I am new to qualtrics so the answer that I'm providing must be taken with a pinch of salt. So, I am assuming that you have your logic right and are already able to differentiate when your question fetches only one choice in your single choice(carry forward) question that follows the multiple choice multiple answer question.
    Thereafter, you need to add this line of code in javascript of your carry forward question:

    document.getElementById(document.getElementsByClassName('q-radio').item(0).htmlFor).checked = true;

    You can use an embedded data which can be set to 1 if there is only one choice that is carried forward, 0 otherwise.

    If you don't want to display this carry forward question to the user if it has only one choice, you can check if the embedded data is set to 1 and can skip to the next page directly by using:


  • TomGTomG Raleigh, NC Wizard ✭✭✭✭✭
    edited July 2018 Accepted Answer

    Show the follow-up question if at least 1 choice is selected in the first question, then try adding this to your addOnReady function on the second question:

    var choiceInputs = this.getChoices();
    if(choiceInputs.length == 1) {
      this.setChoiceValue(choiceInput[0], true);


Sign In to Comment