Adding media library field on any entity and making it as required. Create the entity and submit the form without having value in media library field and it will show wrong validation message.
Steps to repeat issue:
1. Enable the Media Library and Media modules.
2. Create content type with Media Library field and make it a required field.
3. Create new content type using Media Library field and save the form to display the wrong error message, "This value should not be null"
See screenshot for error message.
Comment | File | Size | Author |
---|---|---|---|
#21 | interdiff_12-21.txt | 2.68 KB | Ratan Priya |
#21 | 3175146-21.patch | 4.55 KB | Ratan Priya |
#19 | interdiff_12-19.txt | 5.7 KB | sahilgidwani |
#19 | 3175146-19.patch | 4.39 KB | sahilgidwani |
#14 | After Patch 3175146.png | 369.49 KB | chetanbharambe |
Issue fork drupal-3175146
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
deepaverma CreditAttribution: deepaverma commentedCreated patch for Drupal 8.9.6
Comment #3
marcoscanoJust a straight re-roll for 9.2.x
Comment #4
volkswagenchickAdding some tags for DrupalCon NA which is happening April 12-16 virtually.
Can steps to reproduce/test/validation be added to the summary?
I tagged this issue novice in hopes that a new contributor could work on this, thanks.
Comment #5
grgcrlsn321 CreditAttribution: grgcrlsn321 as a volunteer commentedComment #6
grgcrlsn321 CreditAttribution: grgcrlsn321 as a volunteer commentedComment #7
grgcrlsn321 CreditAttribution: grgcrlsn321 as a volunteer commentedUpdated summary.
Comment #8
Abhijith S CreditAttribution: Abhijith S as a volunteer and at Zyxware Technologies commentedApplied patch #3 and it works fine.The error message is showing correctly with the field name after applying this patch.
Before patch:
After patch:
RTBC +1
Comment #9
grgcrlsn321 CreditAttribution: grgcrlsn321 as a volunteer commentedTested patch and works as expected with correct error message, "Media content field is required."
Comment #10
catchWe should add a positive assertion here for the text we actually expect to get, otherwise there's no guarantee we're getting a validation message at all.
Comment #12
vakulrai CreditAttribution: vakulrai as a volunteer and at QED42 for QED42 commented@catch , I have rerolled and modified the patch. I have replaced
pageTextNotContains
withpageTextContains
assertion.Thanks.
Comment #13
chetanbharambe CreditAttribution: chetanbharambe at QED42 for Drupal India Association commentedComment #14
chetanbharambe CreditAttribution: chetanbharambe at QED42 for Drupal India Association commentedVerified and tested patch #12.
Patch applied successfully and looks good to me.
Testing Steps:
# Goto: Extend -> Enable the Media Library and Media modules.
# Create the content type with the Media Library field and make it a required field
# Create the new content type using the Media Library field and save it.
# User is able to see a wrong error message, "This value should not be null"
Expected Results:
# User should see the message like "Media field is required"
Actual Results:
# User is able to see a wrong error message, "This value should not be null"
Can be a move to RTBC.
Comment #15
catchThis feels like it shouldn't be necessary. Is there a reason we can't use the browser's own required form element feature? Going to tag for subsystem maintainer review.
Also feel like 'The value should not be null' isn't really good for any situation, so what about changing the default message itself?
Comment #19
sahilgidwani CreditAttribution: sahilgidwani at Axelerant for Drupal India Association commentedRerolled patch 12 for Drupal 9.5
Comment #21
Ratan Priya CreditAttribution: Ratan Priya at OpenSense Labs for DrupalFit commentedTried to re-roll patch #12 for 11.x-dev.
Comment #22
smustgrave CreditAttribution: smustgrave at Mobomo commentedDid not test but was previously tagged for issue summary update which still looks like needs to be done.