Problem/Motivation
In a managed_file element validation is performed during the AJAX calls on upload and remove. The validation result isn't used and it looks like it was intended to be disabled by setting #validate to []:
https://git.drupalcode.org/project/drupal/-/blob/11.1.1/core/modules/fil...
https://git.drupalcode.org/project/drupal/-/blob/11.1.1/core/modules/fil...
However, using an empty array has the same result as not setting #validate at all: Default form validation.
Proposed resolution
Set #validate to a callback function that does nothing.
Issue fork drupal-3503297
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
quietone commentedComment #7
riyas_nr commentedSince validation is explicitly defined in the getInfo() method through
#element_validate => [[$class, 'validateManagedFile']](source), it is clear that validation is intended for theManagedFileelement. Therefore, there is no need to create an empty validation method to disable it, as validation is required and should not be bypassed.I initially raised a MR with a proposed solution to disable validation, but the pipeline failed due to test case failures related to text and the
ManagedFileelement. This indicates that validation is indeed expected and required for this element. We might need to analyze the test failures to determine if they highlight an actual issue or if the approach needs further refinement.