#limit_validation_error reset form_state values in ajax request

Created on 28 June 2020, over 4 years ago
Updated 21 July 2023, over 1 year ago

Problem/Motivation

When #limit_validation_error is set for an element (managed_file for example) the "handleErrorsWithLimitedValidation" function in Drupal\Core\Form\FormValidator will set form_state values to the limited validation fields only, this will prevent us from retrieving the values (fom_state->getValues()) in the form build.
In our case, we need to access the values in the formBuild to execute some logic and field dependencies using ajax.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
FormΒ  β†’

Last updated 2 days ago

Created by

πŸ‡―πŸ‡΄Jordan Anas_maw

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.

  • πŸ‡¬πŸ‡§United Kingdom nlisgo

    I'm struggling to understand whether this is an issue that we can replicate in core or we need to understand more about your specific use case in order to recreate the problem.

    There is a test which covers handleErrorsWithLimitedValidation is found here: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/tests/Drupal/...

    Can a test case be surfaced to express the issue? Or perhaps one of the provided examples is sufficient but we are overlooking checking other values which are affected?

Production build 0.71.5 2024