I’m using Symfony UX Live Components and facing an issue where file validation does not trigger simultaneously with other form fields (e.g., text inputs). Instead, file validation only occurs after the other fields pass validation.
What I Expected
In a standard Symfony form, file validation (e.g., FileType with constraints like maxSize or mimeTypes) works independently of other fields. If a file is invalid, its error appears immediately, regardless of whether other fields (like title) are valid or not.
What’s Happening in Live Components
With Live Components, it seems like:
The form first validates non-file fields (e.g.,
title).Only after those pass validation does it check the file input.
If
titleis invalid, file validation errors do not appear at all.
Example Setup
FormType:
$builder ->add('title', TextType::class, ['constraints' => [new NotBlank()]]) ->add('image', FileType::class, [ 'constraints' => [ new File(['maxSize' => '2M', 'mimeTypes' => ['image/jpeg']]) ], ]);Live Action:
#[LiveAction] public function saveTourDetails(Request $request) { $this->submitForm(); }Button:
Question
Is this expected behavior in Symfony UX Live Components?
If not, how can I ensure file validation runs alongside other fields, just like in a normal Symfony form?