Hi,

I have a paragraph with a media field which is required. When I select the image media in the Browse media popup and save it I get "This value should not be null.".

1. Create a paragraph
2. Add a Media field which allows for Images
3. Set the field above as 'required'
4. Attach the paragraph to a content type
5. Create content
6. Click on Browse media
7. Select an image
8. Click on save

Result: This value should not be null.

Expected result: the image should be referenced

Note: If the field is not required the field works properly.

Comments

carolpettirossi created an issue. See original summary.

miro_dietiker’s picture

Is this maybe a duplicate of the related issue?

carolpettirossi’s picture

Not really. I think it's duplicated of this core issue: https://www.drupal.org/project/drupal/issues/3003150

As mentioned there, a solution is to use the Experimental widget instead of Classic.

daveiano’s picture

Patch https://www.drupal.org/project/drupal/issues/3003150#comment-13276326 from the suggested issue in #3 works and solves the problem for me.

berdir’s picture

Status: Active » Closed (duplicate)

Good, I would have expected #3013171: LogicException Form errors cannot be set after form validation has finished which is in in 1.9 to fix this as well but if it didn't then I don't think we can fix it in paragraphs.