Creating multiple choice questions in multiple choice questions

Hi all,

I am trying to create a form that will have multiple choices "layered" within others. for example

Species found:
Snake □
Frog □
Rabbit □

Snake Age
Geriatric □
Adult □
Juvenile □

Rabbit Age
Geriatric □
Adult □
Juvenile □

however although i can initially select multiple options in the first section, if i do so it will miss out the next lot of questions. this only seems to work if i select one option in the previous section.

I am currently using " (${species_found}='snake') "and so on.

I have tried grouping these to see if this will help the issue but doesn't seem to work.

My end goal is to ideally have this layout set up so i can have a set of 4/5 questions all layered up with different sub questions and sub sub questions.

Many thanks

Hello @JH,

I suggest you create a repeat based on selected options. This freely allows you to extend the list of additional questions and options of animals in case you have more with less coding.

You will need below functions to achieve the solution
-count-selected() to control the repeat_counts

  • position() to iterate through the select_multiple indices
  • jr:choice-name to retrieve and display the label option at x position/index

With that you could then do the normal relevant and constraints to show or hide some questions based on the choices made previously.

Also depending on how you will analyze the data, you could still use the animal variable (this time as select one) in the repeat and pass the position() value in the calculate to keep track of which animal you are asking questions about

I am writing this on-the-go, and unfortunately won't be able to attach the sample XLSForm, but if you like the ideas could mail that to you Thursday.

I would also urge that you go though the ODK manual, or search through the forum for similar solutions

Happy ODKing and festivities

JR