Form field Country
In some cases, you may want to collect information about their country living in.
Frontend
Field Options
All the normal options are present in this field, to read more about them please continue in this link.
But the most important option in this field is to populate the list using a JSON string. If you are not familiar with JSON read more here.
The next image shows the General options available for this element.
The option `Country JSON` is the option to populate the list in the dropdown. This option accepts a valid JSON with the format `key:name` where the key is the code for the country.
Important about this option.
- To validate the JSON is correct, I recommend the online tool json formatter and validator.
- If you leave the field empty and save the form it will load the default list of countries.
- The list will show by default the first element.
- To show a place holder insert one empty key element as the first element on the list, like in the next example.
- The format of `key:value` is important because the State element have an option to link with the Country list base on that key. Keep reading.
Link with State
This option will link this Country Element with the next State element present in the form.
Example of JSON with fewer countries.
{
"": "--Select State--", "nostate": "No State", "US": "Unite State", "UY": "Uruguay", "CU": "Cuba", "UZ": "Uzbekistan" }