#limit_validation_errors related issues

Created on 5 January 2024, 12 months ago
Updated 3 April 2024, 9 months ago

Problem/Motivation

#limit_validation_errors causes some issues in this module. For example, if the content type contains any 'select' field, we are getting an error when clicking on the Sidekick button.

```
TypeError: Drupal\Core\Field\WidgetBase::massageFormValues(): Argument #1 ($values) must be of type array, string given, called in /var/www/web/core/lib/Drupal/Core/Field/WidgetBase.php on line 386 in Drupal\Core\Field\WidgetBase->massageFormValues() (line 534 of /var/www/web/core/lib/Drupal/Core/Field/WidgetBase.php)
```

The problem originates from the Drupal core bug, which triggers under specific circumstances. Circumstances are:

- AJAX is used
- #limit_validation_errors is used
- $entity_form_display->extractFormValues( is used in AJAX callback

And that's exactly the case in the sidekick module. Some related issues are:

https://www.drupal.org/project/drupal/issues/3155438 🐛 #limit_validation_error reset form_state values in ajax request Active
https://www.drupal.org/project/commerce/issues/3136525

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

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

Comments & Activities

  • Issue created by @dejan0
  • Temporarily patch is here, it disables #limit_validation_errors. Not ideal, as validation errors now might be triggered during AJAX call (Sidekick button), and visible on the next page. And that might be just confusing for editors... But yes, at least Sidekick now works, and no more errors. Let's see if we can find a better solution here

  • Status changed to Fixed 9 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024