How to make Country - State dropdown in mendix?

1
  I want to make list of country in dropdown and according to selection States will be list down.
asked
3 answers
3

Hi Sunil,


If you have the list of countries and States as an excel sheet you can use the excel importer module, and the prerequisite to use this you need to create the Country and State entities with May To One association of course, and you need a reflection module to reflect your entities to be able to see them as an option to import to from the excel importer.

After that on your page add 2 dropdown lists one for the country and one for the states, set the Constrained By option in the States dropdown data source on the states on the level path between States>your main request entity> county. in this way your states values will be refreshed depends on the selected county

This documentation link will help you out too : https://docs.mendix.com/refguide/reference-selector

answered
0

Hi, 

  1. You have to enter the state fields and country manually from an Admin page and assign countries to a group of states.
  2. Create associations between your entity and the country and state entities. 
  3. Set the selectable objects in country from the state selected on the current object. 

This should do the trick. Hope this helps. 

answered
0

Hi Sunil,

You can use the Xpath 'constrained by'  to make one reference selector dependent on another. Refer https://docs.mendix.com/refguide/reference-selector#xpath-constraints 

Regards,
Hari

answered