diff --git a/core/lib/Drupal/Core/Render/Element/RenderElement.php b/core/lib/Drupal/Core/Render/Element/RenderElement.php index 73b4c36..c0fd91a 100644 --- a/core/lib/Drupal/Core/Render/Element/RenderElement.php +++ b/core/lib/Drupal/Core/Render/Element/RenderElement.php @@ -240,6 +240,11 @@ public static function preRenderAjaxForm($element) { // re-rendering. For that, we have a special 'system/ajax' route. if (isset($settings['callback']) && !isset($settings['url'])) { $settings['url'] = Url::fromRoute(''); + // Add all the current query parameters in order to ensure that we build + // the same form on the Ajax POST requests. For Example the AccountForm + // takes query parameters into account in order to hide the password + // field dynamically. + $settings['options']['query'] += \Drupal::request()->query->all(); $settings['options']['query'][FormBuilderInterface::AJAX_FORM_REQUEST] = TRUE; // Specify that we expect HTML back, despite the AJAX request. $settings['options']['query'][MainContentViewSubscriber::WRAPPER_FORMAT] = 'html';