Search by

drupal-eca-recipe / eca_lib_0040

Provides a Location content type with dependent Country, State or province, and City select fields. ECA adds Ajax handlers and populates the downstream options from a compact demonstration data set.

Maintainers

Package info

gitlab.lakedrops.com/drupal/recipes/eca_lib_0040

Type:drupal-recipe

pkg:composer/drupal-eca-recipe/eca_lib_0040

Transparency log

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

1.0.2 2026-08-28 18:37 UTC

This package is auto-updated.

Last update: 2026-08-28 18:39:25 UTC


README

ID: eca_lib_0040

This model provides dependent Country, State or province, and City select fields on the Location content form. Choosing a country refreshes the available states or provinces through Ajax. Choosing a state or province refreshes the available cities.

How it works

The form build event adds Ajax handlers to the Country and State or province fields. Each form rebuild first clears the dependent options. Conditions compare the submitted form values and then populate only the matching downstream options.

Test data

The compact demonstration data contains Canada, Germany, and the United States. Each country provides three states or provinces, and each state or province provides two cities. Country and subdivision keys use ISO 3166 codes where applicable.

Installation

## Import recipe
composer require drupal-eca-recipe/eca_lib_0040

# Apply recipe with Drush (requires version 13 or later):
drush recipe ../recipes/eca_lib_0040

# Apply recipe without Drush:
cd web && php core/scripts/drupal recipe ../recipes/eca_lib_0040

# Rebuilding caches is optional, sometimes required:
drush cr