JSON in dropdown list

1
0
-1

Hello guys,

Im working in a process with a form which have:
- input text for Cities
- input text for States
and i want to change for a dropdown list for each one, im having a problem with JSON, i cant show the JSON data correctly in displayed key.
i have this file: https://gist.githubusercontent.com/lucashort7/313bec7d4a8b82472ac1999368...
i want to show all states ("estados") in one drop down, and in the other all cities ("cidades") based on which state the user choose, like this : estados[states.selected].cidades
i got this so for(all cities in one line:
http://imgur.com/a/gQayO

1 answer

1
0
-1

Hi,

In the "displayed key" field, you provided estados[0].cidades which point to an entire list of value. That's why the dropdown display only one option and that option is the flatten list of all the cities available.

The dropdown list accepts either an array of value or an array of objects. In both cases, this array is provided by the field "Available values":

  • An array of value will look like ["Madrid", "Barcelona"]. In that case, you can leave Displayed Key and Returned Key empty. The value displayed, returned and stored in the field "Value" will be either Madrid or Barcelona, depends on user choice.

  • An array of Objects will looks like [{"id":1, "city": "Madrid"}, {"id":2, "city": "Barcelona"}]. In that case, you will have to precise what is the value to display and what is the value to return on user selection. In this case, you will enter city in the field "Displayed Key" and id in the field "Returned Key", which means that the dropdown list will display Madrid and Barcelona as available choices but will return 1 or 2 as value to store.

Cheers

Testing
Notifications