2

there is two content types "country" and "state". content type "state" has entity reference field for "country".

there is another content type called "shop" which has two entity reference field for "country" and "state".

when i creating "shop" it display all the "state" .

but i want something like when user select one country, the corresponding states to the country should display.

how to do that help needed .

1

1 Answer 1

2

It appears like you are looking for Reference field option limit module. Your case is their first example:

Example 1: countries and cities

Suppose you want to label articles (or products, or businesses, etc) by both city and country so both can be used for filtering and searching. You could use a hierarchical taxonomy with city terms as children of country terms, but that doesn't make sense when you come to set up Views filters.

With this module, create two separate taxonomies for country and city (or content types, or whatever entity you want to use). Then add a reference field so that each city points to its country: eg, the term 'Paris' has a reference to 'France'.

Then when editing an article, selecting 'France' in the country field will cause the city field to update to show only cities in France.

And yes, it works with nodes just as well as with taxonomies, as both kinds are entities.

2
  • the check box is disabled. Limit this field's options according to matching field values
    – amal
    Commented Oct 9, 2013 at 9:44
  • @amal have you done everything exactly like they described? It worked for me. "no repo" here unless you can provide some more data (in new question if it would change meaning, and it would if you are to ask about specific implementation problems).
    – Mołot
    Commented Oct 9, 2013 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.