views exposed form alter throw The uploaded file likely exceeded the maximum file size

Created on 17 May 2025, 7 days ago

Problem/Motivation

I try to alter views exposed form to add ajax behaviour to a select.
This is my simple code that works fine with Drupal 10.

     $form['field_brand_ref']['#ajax'] = [
        'callback' => '_test_filter_callback',
        'wrapper' => 'select-replace',
        'event' => 'change',
        'progress' => [
          'type' => 'throbber',
        ],
      ];

      $form['select-replace'] = [
        '#markup' => '<div id="select-replace">text to replace </div>',
      ];


function _test_filter_callback($form, FormStateInterface $form_state) {

$response = new AjaxResponse();
  $form['select-replace'] = [
        '#markup' => '<div>new text</div>',
  ];

      $response->addCommand(new ReplaceCommand(
        "#select-replace",
        $form['select-replace']
      ));

}

When i change value of the select i get this error:
An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports

But i only change select value, i don't upload a file.
There are other issues
https://www.drupal.org/project/drupal/issues/3351849 🐛 Ajax throws the wrong error when failed Closed: duplicate
https://www.drupal.org/project/drupal/issues/3247064 🐛 Error message presented when a BrokenPostRequestException is fired on AJAX submission can be misleading Needs work

but the problem is that in the html form there is no form_id field.
How can add ajax behaviour to my select with Drupal 11?
Thank you

Steps to reproduce

Alter form
Add ajax behaviour to a select
Change value to the select

🐛 Bug report
Status

Active

Version

11.1 🔥

Component

ajax system

Created by

🇮🇹Italy trickfun

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

Comments & Activities

Production build 0.71.5 2024