How to make Country - State dropdown in mendix?

0
  I want to make list of country in dropdown and according to selection States will be list down.
asked
4 answers
2

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
1

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
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

you'll need to create three main entities: state, country, and location. They'll be interconnected through associations as follows:

State and Country: This relationship is a one-to-many association because a country can encompass multiple states, but each state belongs to only one country.

Country and Location: Similarly, this relationship is also a one-to-many association, but the "many" side is represented by locations. A country can have many locations within its boundaries.

State and Location: Again, a one-to-many association, where a state can have multiple locations within it.

Additionally, you mentioned setting up a dropdown menu for states on the location NewEdit page, with the source chosen as Xpath.

Now, when it comes to importing data, manual entry might not be feasible. Instead, you can leverage either an Excel importer or utilize an available API to fetch data for countries and their respective states. This allows for efficient data population without the need for manual input. for more help go through --- https://docs.mendix.com/refguide/reference-selector/

answered