Default response based on previous answer

Hi! I’m trying to set a default answer in my form based on a previous answer (im using choice_filter). I mean I have a huge list of schools and each shools has an ID number so i need that when you select the school then the form shows you the id number of that school.

For example:

  1. select your school
  • Normal superior
    *Sagrado corazón
  • Maria
  • HHHH
  1. The ID of your school is
    xxxxx

Welcome @kari_0110,
There are at least 4 solutions.
Often using the search function of the forum (and the Help Center articles) can provide help and examples. See e.g.

As first option https://community.kobotoolbox.org/t/how-to-generate-dynamic-labels-based-on-a-calculation/15791/4.

A 2nd simple option would be to use the IDs as choice names and the countries as labels in the same choice list. ${selectVar} would give the ID (i.e. name of the choice item). An advantage is that you easily get the ID also in the export.

A 3nd option would be to use the first value as a choice_filter for the ID list and a select_one type, read_only (and relevant) and with a calculation to set/select the ID choice.

A 4th option would be to use pulldata (or select_from_file) from an external file instead of the choice list to get school names and IDs.

2 Likes

@kari_0110, maybe this post discussed previously should help you understand more about the cascading select question:

In addition, you could also learn more through our support article Adding Cascading Select Questions