Modal doesn't validate upload

Created on 28 February 2018, over 6 years ago
Updated 10 September 2024, 2 months ago

When using entity_browser with a modal widget. If you upload an image file none of the validation is processed.
If title and alt tag are required the form fields to provide title and alt tag are not displayed. Only the file upload field is presented in the modal.
Also if dimension or filesize doesn't match the file is still be saved without an error being displayed.

Workaround:
You can click EDIT after the file has been attached and the ALT field will appear and other validations will be checked if you click UPDATE.
But you can also close this window without setting an alt field and still save the node that the file is attached to without an error being thrown.

How can I attach a file using iframe or modal, require alt field and pass all validation without having to click EDIT to view the full form of the attached file? Shouldn't the form be presented once the file upload is completed within the modal window?

UPDATE
After taking a closer look at the example I'm noticing the the widget which the uploaded file gets placed into after using the entity browser isn't the table list which exposes the metadata fields which does require the ALT field.

So now I'm wondering how or why this isn't the default field widget (or how to select this as the widget) for where files are displayed by default. Instead of just showing the file widget which allows "edit" and "remove" next to a thumbnail.

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Field widget

Created by

πŸ‡ΊπŸ‡ΈUnited States davidburns Philadelphia

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 States SamLerner

    I'm having an issue where in layout builder, when I have a custom block with an image field, the alt text isn't being validated if it's empty. It's supposed to be a required field, but you can leave it blank and still save the block.

    When you go to the block, you'll get an error when trying to save if the field is still empty. But during the initial block creation, the validation doesn't seem to be working.

  • πŸ‡¬πŸ‡§United Kingdom Alina Basarabeanu

    We came across this issue on multiple projects using D10.2 and the entity browser 2.9.0
    Tested on older Drupal core versions and entity browser we get the error too.
    The patch from #6 solved the error for a field type Entity reference to a media on a content type. The widget used by the Form display is 'Entity Browser'.

  • πŸ‡¬πŸ‡§United Kingdom Alina Basarabeanu

    Updated patch for version 2.11

Production build 0.71.5 2024