I have attached screenshots to help illustrate this issue. If you add more than one address field on a single form the 'Used field' settings are not respected for the second field. You can see on the screenshot that I have added two address fields. The first one only allows for selection of a country. The second allows for a complete address. On the actual form, though, both fields only allow for the country to be input.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bletch created an issue. See original summary.

bletch’s picture

Just to clarify, this problem persists once a country is selected. The screenshots were taken without the selection.

dww’s picture

Version: 8.x-1.0-rc3 » 8.x-1.x-dev
Status: Active » Closed (works as designed)

I tried it with 2 address fields on the same entity bundle, the first collecting just country and administrative area, the 2nd collecting everything but names.

It indeed appears to be broken in 8.x-1.0-rc3. I can select a country in the first field, and the appropriate administrative area appears. However, any changes to the 2nd field's country are causing the AJAX callback to fail, so no form elements for the subfields are inserted.

After upgrading to the end of the 8.x-1.x branch (currently @ commit bca416ec) and it all works fine. So one of the commits between 2722646..bca416ec has already fixed this bug. Not sure it's worth investigating further, other than confirmation that upgrading to the latest 8.x-1.x-dev resolves the bug for you, too. If not, please reopen this issue.

Thanks,
-Derek

dww’s picture

Looking briefly at the git log and the error I saw when I tested this, it's now obvious that #2619878: Recoverable fatal error: Argument 1 passed to Drupal\\Core\\Form\\ FormState::setError() must be of the type array is the issue where this bug was fixed.

Cheers,
-Derek

bletch’s picture

Cool, thanks for looking into this. I will make sure to update.