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)

Selected media item

  • 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

Media library with both items selected

  • Click 'Insert selected'

Two items selected in the field

  • 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

Comments

blacklabel_tom created an issue. See original summary.

phenaproxima’s picture

Status: Active » Closed (duplicate)
Related issues: +#3059955: It is possible to overflow the number of items allowed in Media Library

This 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. :)