"This Value should not be null" Validation Error With Paragraphs using Media Fields

Created on 4 November 2024, 20 days ago

Problem/Motivation

There is an issue when using Inline Entity Fields (doesn't seem to matter which kind but I used complex) in a paragraph field attached to a node that has a cardinality greater than one, in which the paragraph (which uses an Inline Entity Form) has a field that has a required media (in my case, image) reference field. If you enter in the required fields, and either try to preview the node, or collapse the paragraph form, an error occurs where EVERY field in the paragraph that contains a media reference will be labelled with an "This Value should not be null" error.

It should be noted this occurs when the form actually should validate. For example, if said paragraph has the media field set as required and you do NOT enter a file for the field, it will correctly display an error on the media field saying that field is required. Its only when all other validation seems to succeed that this particular issue happens. The "This value should not be null" error also seems to appear for every single field, including fields that are not full.

You can see an example of this in the screenshot I uploaded.

Steps to reproduce

I was able to replicate the issue using the following https://simplytest.me/ configuration:

  • Drupal 10.2.9
  • IEF module
  • Field Group Module
  • Paragraphs

Field Group I used to try to get a clean drupal install that is as close to my specific situation as possible. May not be necessary to replicate the issue.

After Installation, log in and then:

  1. Enable Media module
  2. Create new paragraph type with a entity reference to a media item (choose image)
  3. Make this media item required in field settings
  4. Create new content type that has a paragraph field for newly created paragraph type. Choose cardinality of unlimited
  5. Set up form display so the new field is in its own tab (may not be necessary)
  6. Create new node of that type
  7. Add an image paragraph to field. Add everything required.
  8. Click collapse button. The "This value should not be null" error will appear
  9. Clicking the Preview button should also cause this error to happen.

I did research this issue a bit before posting this, there are a couple related issues that seem to cover this, but don't seem to solve the problem, and have a few differences in context that I figured I should create a new issue, especially since most related problems are for different versions. If I was mistaken and should have added to those other issues, please let me know.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

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

Comments & Activities

Production build 0.71.5 2024