How to make only certain answers show up in subsequent questions

I have a question on how to make only certain answers pop up depending on the answers to previous questions. We have a question on occupation asking respondents to choose their 5 most recent sources of income from a list of possible occupations. We then ask about those 5 jobs in later questions and we would like if we could limit the answer options for these later questions to only the answer options they picked in the first question. How can we do this? I only see a forum post detailing how to make certain questions show up based on the answers to previous questions.
Thanks so much!

@mstoeltje , can you try this XForm.

<!-- Question 1: Choose 5 most recent sources of income -->
<select_multiple name="income_sources">
    <label>Choose your 5 most recent sources of income:</label>
        <label>Job A</label>
        <label>Job B</label>
        <label>Job C</label>
    <!-- Add more items for other jobs -->

<!-- Question 2: Details about Job A -->
<text name="job_a_details">
    <label>Enter details about Job A:</label>
    <hint>Only answer if Job A was selected in the previous question.</hint>
    <choice_filter>selected(${income_sources}, 'job_a')</choice_filter>

<!-- Question 3: Details about Job B -->
<text name="job_b_details">
    <label>Enter details about Job B:</label>
    <hint>Only answer if Job B was selected in the previous question.</hint>
    <choice_filter>selected(${income_sources}, 'job_b')</choice_filter>

<!-- Question 4: Details about Job C -->
<text name="job_c_details">
    <label>Enter details about Job C:</label>
    <hint>Only answer if Job C was selected in the previous question.</hint>
    <choice_filter>selected(${income_sources}, 'job_c')</choice_filter>

<!-- Add more questions for other jobs using similar format -->

Step2:copy the entire code and save it as my_survey.xml. in your notepad.

To convert the XML file to XLSForm using XLSForm Online:

  1. Open your web browser and go to the XLSForm Online tool website: ODK - XLSForm Online
  2. Click on the “Choose File” or “Browse” button to upload your XML file.
  3. Once the file is uploaded, click on the “Convert” button.
  4. The tool will process the XML file and generate a downloadable XLSForm file.
  5. Click on the “Download XLSForm” link to your computer.

Finally upload the XLSFORM to kobotoolbox form builder.

1 Like

@mstoeltje, this post discussed previously should help you solve your issue:

Ok thank you! I think what we want is we have 15 different occupations listed in the first question which asks them to pick 5 of those options. That is a question that allows us to select multiple answers. We then have 8 questions following that are a single choice selection from those same 15 options. We would like for the following 8 questions to only show the choices that they chose in the 1st question. How would the cascading select work in that case?

@mstoeltje, could you share your sample dummy questions, choices, and the details you wish to be seen when something this selected/chosen? These details should be helpful for the community to help you solve your issue. But please try to keep the questions and choices simple so that it’s easy to understand.

The first picture shows the first question which is a multiple select and we have them choose a maximum of 5 of the answers. Then the second question is a single select and we would like only the answers selected in the first question to show up for that. How can we make this happen? Thanks!

@mstoeltje , May you can take a look at this previous discussion:

You might as well also go through this:

Ok thanks, but how do we get those same answers to show up in the next question? So it looks like here that it counts the answers and then the next questions show up based on how many were chosen but we don’t want it to autoselect the answers in Q2. We want them to choose 5 answers in Q1 asking about all their past occupations and then only those 5 answer choices show up in Q2 where we have them select the most recent of those.

Alright @mstoeltje, This is probably what you want.