In my Elm app, I have two ‘select’ elements, ie dropdowns. The first is the main category, the second a list of sub-categories dependent on the content of the main category.
For example, if the main category shows a list of countries, then the sub-category contains a list of cities within that country. The ‘view’ function is then instructed to show information relevant to that city.
Whenever I change the main category, the contents of the sub-category change to show the relevant items.
But what I cannot do is to access the index of the sub-category. If I have selected main category ‘Italy’ and sub-category ‘Milan’, when I change the main category from ‘Italy’ to ‘Greece’, I want to reset (or retrieve) the current index of the sub-category, so that I know what information to display in the ‘view’ function.
If I cannot do this, then what appears as the sub-category item is out of sync with the information displayed in the ‘view’ function.
Is there some way to do this?