Problem/Motivation
Bit of an edge case this one, but users are able to add more than one media item to a field that has been limited to just one item. When saving they then see a 'Image: this field cannot hold more than 1 values.' message.
This does stop them saving the node, but it would be great if the user could be blocked before this.
Steps to reproduce
- Setup a media reference field on a node and limit to one value allowed
- Make sure you have at least one item in the media library already
- Add a new node and click 'Add media' on the field
- Select an existing media item (other items are then greyed out)

- Then click on the 'Browse' button on the add media section of the media library
- Upload another file
- You will then go back to the media library with both media items selected

- Click 'Insert selected'

- Click save on the form
- See the 'Image: this field cannot hold more than 1 values.' error
Proposed resolution
If possible I think it would be best to disable the 'Browse' button when the media item has been selected. In this case its a single item, but in the case of multiples it should grey out when the field limit is hit.
This is VERY much an edge case, but possible for a content editor with no much Drupal experience to bump into.
Cheers
Tom
| Comment | File | Size | Author |
|---|---|---|---|
| Screenshot 2021-08-27 at 3.47.21 pm.png | 245.96 KB | blacklabel_tom | |
| Screenshot 2021-08-27 at 3.47.11 pm.png | 613.66 KB | blacklabel_tom | |
| Screenshot 2021-08-27 at 3.46.51 pm.png | 638 KB | blacklabel_tom |
Comments
Comment #2
phenaproximaThis is a duplicate of #3059955: It is possible to overflow the number of items allowed in Media Library, so closing in favor of that one. :)