Changing Country in an Address form triggers an AJAX request to update State/Province options, but the request fails with HTTP 500.
Expected:
Selecting a country should refresh State/Province options and allow continuing the form.
Actual:
AJAX fails (or hangs on “Processing…”), and the form cannot continue normally.
Error seen in logs:
TypeError: Drupal\address\Plugin\Field\FieldWidget\AddressDefaultWidget::errorElement(): Argument #1 ($element) must be of type array, null given, called in /core/lib/Drupal/Core/Field/WidgetBase.php on line 580.
Environment:
- Drupal core 10.6.2
- Address module 2.0.4
- Profile module 1.14.0
- Commerce module 3.3.5
- PHP 8.3
- DDEV local environment
Steps to reproduce:
- Open a form that uses the Address widget with Country + State/Province fields.
- Select a different country (example: United States to Canada).
- Wait for AJAX to refresh State/Province.
- Observe AJAX 500 error / stuck processing state.
Additional notes:
This appears to happen during AJAX rebuild/validation of the Address widget when handling validation errors and mapping the error element.
Issue fork address-3590661
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2.0.x
changes, plain diff MR !95
- 3590661-selecting-country-to
compare
- 2.1.x
changes, plain diff MR !94
Comments
Comment #5
jcontreras commented