Media forms with a required select list field break after first submit

Created on 24 June 2024, 4 days ago

Problem/Motivation

We have media forms with a required field that states whether we own the media, or not (select field, text). If the media items is not owned by us, it is required to have credit provided for where the image came from.

If you fill out the form for a media item, but skip the required field for media ownership, the form will refresh and display the validation error. From here on out the form will not submit no matter what.

Steps to reproduce

We have verified this issue exists using https://simplytest.me/ and just this module

Go there, create a new site with this module (Drupal 10)

Add a required select list to the image media type.

Go to create an image, do not select an item, hit submit and get the validation error.

Select a value, attempt to submit. No longer submits and returns the following JS console error:

"An error occurred during the execution of the Ajax response: Error: cannot call methods on dialog prior to initialization; attempted to call method 'close'"

Commenting out media_library_media_modify.module line 213 does remove the issue, but haven't tested what other implications it has, but a decent starting point for folks looking to troubleshoot this.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jnicola

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024