- Issue created by @trickfun
- 🇳🇿New Zealand quietone
This is the same error message as 🐛 Error message presented when a BrokenPostRequestException is fired on AJAX submission can be misleading Needs work . Therefor closing as a duplicate.
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
Alter form
Add ajax behaviour to a select
Change value to the select
Active
11.1 🔥
ajax system
This is the same error message as 🐛 Error message presented when a BrokenPostRequestException is fired on AJAX submission can be misleading Needs work . Therefor closing as a duplicate.