ajax error when displaying a webform with address field

Created on 13 September 2022, about 2 years ago
Updated 20 August 2024, 3 months ago

I get an ajax error trying to fill out a webform on a view_mode_page.
Specifically with an address field on the webform.
When selecting a country, it ajax-submits to fetch the correct address fields.
That one errors out with the cryptic "An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports."
There are no file uploads whatsoever on my webform...

The webform itself works fine when using directly through webform.
It also works fine when using it placed via a block or paragraphs on a page.
It only fails when using it on a display mode rendered through view_mode_page.

I managed to debug it to view_mode_page: MainController.php: displayEntity(): line 89:
$response = $this->httpKernel->handle($sub_request, HttpKernelInterface::SUB_REQUEST);
But I'm stuck debugging this any further...

Could someone help to get this fixed?

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇧🇪Belgium weseze

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇪🇪Estonia minff

    I can confirm that this issue persists and effectively renders webforms used in view mode page not usable if they require any Ajax (such as adding another element). The Ajax URL in the JSON code points to the main view mode and therefore results in a JS error.

    Setup in my case: the content type has several view modes activated, with the default view mode not having any webforms (node/1), while other view modes rendering webforms (node/1/application, for example). Webforms function normally outside of the view mode but since the Ajax call points to the default view mode (node/1) when making the call, it results in an error.

    The issue indeed comes from the \Drupal\Core\Render\Element\RenderElement::preRenderAjaxForm() returning the default view mode URL, as pointed out by the previous commenter. Haven't found any non-dirty fixes thus far.

Production build 0.71.5 2024