How to change the available select values depending on previous input (Country - city)



I am working on a form where a user must input the countries he or she has visited, and according to the answer of this field, a list of appropriate cities loads as available values for the next select field, cities.

However, I am having trouble restricting the available values for the second field because the user can input multiple countries, and then multiple cities within those countries.

In theory, if I could access the $collection or $item variables in a javascript, I could use a comparison to return the appropriate list of cities, but these variables are not accessible in javascript variables.

If anyone knows how to restrict the dropdown values of a select field according to a previous answer on a select field in the same collection item, I would appreciate any help.


No answers yet.