I am on Drupal 9.3.x

I just discovered that File Field in node entity form which is marked as required, not showing client side validation fail message. Rather it submitting the form and then showing the validation fail message.

This is causing issue for my modal form. I am loading the entity form's custom form mode into modal. The file field is marked as required, actually its a media field which is linked with a field field. So when user submitting the form, its not validating that, file is not uploaded and submitting the form, getting out of modal window and showing the validation fail message.

Searched in the net a lot, getting no clue. The following things tried:

  • Added an another test file field (not media field), its the same results
  • Added a custom managed file field using hook_form_alter, its the same results
  • Tried to submit the form through ajax, I see no form error reported for media field field

I am not sure if the as designed by Drupal or if there is any fix for it.

One more thing, field is added inside commerce product and field is showing inside inline entity form in simple mode.

Please help. :(

1 Answer 1


I don't have a complete answer for you but I have run into the same issue. The root of the problem appears to be that Drupal doesn't support client side validation of a "managed_file". However if you switch your field type to "file" it should work. It appears this is an issue for many people but no true fix I've found yet. https://www.drupal.org/project/drupal/issues/2938441 https://www.drupal.org/project/drupal/issues/2301527

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.