Problem/Motivation
First, it isn't clear to me if this is something that should be logged against Core or the Paragraphs module. It's hard to know if it's core behavior that creates unexpected results in certain situations (like nested forms) or if it's an issue with how Paragraphs are submitted/validated. I can't find a similar issue in either place.
Steps to Reproduce
- Install Drupal 8.6.x with the core Media and Media Library modules enabled; also install/enable the contrib Paragraphs module.
- Create a Paragraph type with a Media reference field that references the Image media type. Make that field required and ensure it uses the "Media library" widget.
- Add a Paragraphs field on one of the content types core adds by default. Enable the paragraph type to be used by that field.
- Navigate to the add form for that content type and add a paragraph of that type. Attempt to use the Media library widget to upload/add a photo.
Expected result: The image gets successfully added, as it would if this field was not in a paragraph or, strangely, if the paragraph's image field is not required.
Actual result: Upon submitting the modal form, a validation error is thrown: "This value should not be null." (See attached screenshot taken using simplytest.me.) The image is never successfully added in the form and as a result, can't be saved. (As previously mentioned, this does not happen when the field isn't required. The image gets added as expected.)
Proposed resolution
Determine if this is an issue with Media Library, Paragraphs, or something else and get it in the appropriate place. Then hopefully get to the bottom of it and create a patch. If someone can at least point me in the right direction of where I might debug this, I could attempt to do so myself.
Thanks for any and all help and for your work on the Media system!
Remaining tasks
TBD.
Comment | File | Size | Author |
---|---|---|---|
#92 | 3003150-92.patch | 11.93 KB | oknate |
#92 | 3003150--interdiff-87-92.txt | 1.5 KB | oknate |
#87 | 3003150-87.patch | 11.99 KB | oknate |
#87 | 3003150--interdiff-81-87.txt | 3.01 KB | oknate |
#81 | 3003150-81.patch | 12.19 KB | seanB |
Comments
Comment #2
Scott Weston CreditAttribution: Scott Weston at Bounteous commentedI've been able to determine that this is happening when using the 'Paragraphs Classic' form field widget (on Manage Form Display tab). When using the 'Paragraphs EXPERIMENTAL' form field widget, the error does not appear for me.
Comment #3
frankdesign CreditAttribution: frankdesign commentedI have the same issue. Using Paragraphs Experimental does not fix the issue. In my case, removing the 'required' on the Media Image field removes the error. So I'm thinking it's related to a deeper Ajax issue in D8 with required fields. See these related posts
https://www.drupal.org/project/drupal/issues/2614250
https://www.drupal.org/project/drupal/issues/2553983
https://www.drupal.org/project/drupal/issues/2027059
https://www.drupal.org/project/drupal/issues/2027059
F
Comment #4
geek-merlinSetting major as this breaks a common use case on a lot of existing sites.
One can even see this critical as making a field non-required is no general workaround
Comment #5
geek-merlinThat dragon already was at IEF:
* #2618502: IEF Widgets are completely broken
* #2580857: "This value should not be null" when saving a form
Comment #6
phenaproximaTagging as part of the Media Initiative, until this is further triaged.
Comment #7
hannessI can confirm #2
works.
I can confirm #3
works.
Comment #8
trebormcSame as hanness, I confirm that with # 2 and # 3 it works correctly.
It seems validation error with ajax forms.
Comment #9
phenaproximaI think this would be a good thing to write a test for, if possible, before we set about fixing it.
Comment #10
geek-merlinI don't see a patch so i guess NW status was accidental.
Comment #11
carolpettirossi CreditAttribution: carolpettirossi commentedComment #12
carolpettirossi CreditAttribution: carolpettirossi commentedI would like to add that 'Paragraphs EXPERIMENTAL' doesn't solve all the issues, for example, if you have a paragraph being referenced into another paragraph. See below the scenario that I have:
- People: image and title
- People list: people, title and subtitle
- Article: people list and other paragraphs
I've changed People in the People list to use EXPERIMENTAL widget and I'm also using EXPERIMENTAL in the Article content type. When I'm adding People list paragraph to the Article I face the 'This value should not be null' message.
Comment #13
rwohlebI can confirm issue described in #12. I'm using the experimental widget and have had no issues when the media field is on a paragraph referenced by a node. However, when it's a paragraph within a paragraph, then the validation error happens.
Comment #14
hoebekewim CreditAttribution: hoebekewim as a volunteer commentedIt seems that the validation call "$display->validateFormValues" inside ParagraphsWidget (Experimental) and InlineParagraphsWidget (Classic) causes the fields to validate. This validation takes the items from subform (the fields concerned) and validates them. Since the field is required and no value is set at this moment, the error message is displayed.
This might be a bug in Paragraphs, or this might be the expected behavior referencing to a shortage inside the Media library module.
Perhaps all of this can be replaced by a solution that ensures the target_id exists inside the element selection upon validation.
Anyhow, I've added a patch that should solve the issue for now, although it would be nice to get some validation on the security implications.
Inside MediaLibraryWidget I've added a function to remove the error message of the validation and I've added an element validation to capture the required field logic.
Additionally I've had to create a new feature inside the FormState of Drupal Core because it currently does not allow to remove a single element from the form_state errors. A workaround by removing all errors and adding the remaining errors back is also not an option because of the check on $limit_validation_errors inside the FormState class on setErrorByName.
Comment #15
hoebekewim CreditAttribution: hoebekewim as a volunteer commentedComment #17
Pauline G CreditAttribution: Pauline G commentedI tested #14 patch after fixing CodeSniffer errors, and it didn't work for me, although the patch applies well.
I opened an issue on paragraphs module 20 days ago: https://www.drupal.org/project/paragraphs/issues/3013035
Comment #18
hoebekewim CreditAttribution: hoebekewim as a volunteer commentedThere is still an issue with the implementation of some abstract classes implementing the FormBaseInterface.
You can fix this by using clearErrors without a parameter and removing the code for clearError from the interface and instance.
I'm doubtfult about originating this issue to Paragraph since this follows a basic validation pattern that is required to be able to valudate the subform fields.
I think the solution resides in providing the value to the form as a validation friendy input field after passing it from the views ( to ensure the target id and optional weight exist and are not empty before the automated submit button trigger, allowing the validation pattern to not throw errors anymore ).
If I can find some time later this week I'll submit an updated patch.
Comment #19
hoebekewim CreditAttribution: hoebekewim as a volunteer commentedI've updated the patch to remove the clearError mechanism and integrated an exception to avoid the validation errors that were previously deleted in a later validation stage.
There is still an exception inside validateElement to capture the empty target_id. Maybe there is another way around this, or maybe this is an indication of a bad validation logic on the Paragraphs side. Anyhow, in between time this patch should do the trick.
Note that I also apply the patch from https://www.drupal.org/node/2663316 , since without this patch, you won't be able to test this.
Comment #20
Lukas von BlarerThe patch works for me. Thanks!
Comment #21
g.weston CreditAttribution: g.weston commentedThis patch is also working for me... Sweeeeeet.
Comment #22
cosmicdreams CreditAttribution: cosmicdreams at Nerdery commentedPatch at #19 is a complete fix for me. Furthermore, by applying the patch to upload a new image then reverting back to core without the patch before saving the node I am trigger these warnings:
Given that this patch establishes the missing validateElement method this seems like a full fix.
Comment #23
webchickLooks like we still don't have tests yet...
Comment #24
phenaproxima+1. We can't fix this without tests of some sort. Otherwise, any time the media library undergoes refactoring (and some heavy refactoring is coming), we could break integration with Paragraphs again. Sorry!
Comment #25
hoebekewim CreditAttribution: hoebekewim as a volunteer commentedI would like to mention that the patch I've created is a workaround to handle the missing target_id upon the submit validation of the media target id's returned from the view modal.
I think the best/cleanest solution is to rewrite the media library widget to not use the field "media_library_update_widget" anymore.
Instead we would have to alter the form_state of the widget and insert the target_id's that are returned from the Views modal (or add the instances), and then update the form using Ajax to contain the values. (or a simular flow).
The problem in the current flow is the absence of access to the form_state of the widget from the views handling, that's why the value is passed to the placeholder field called "media_library_update_widget".
In short:
We need the logic that the entity reference field uses right now to add multiple references to a field, and link the views output in between.
In the above described scenario, I believe we don't need a test because the implementation will follow the default entity reference logic, which will result in applying the tests from this module to ensure the value of the target id. The missing target Id also references to the fact that this field is required and the value is empty, for which a test also already exists.
As soon as I can find the time, I'll have a look into refactoring the widget to take this into account.
Comment #26
phenaproximaI appreciate the work you folks are putting into this bug, but please don't refactor the media library.
The core media team is already planning to do some heavy refactoring and redesign work for the media library in 8.7, and that work may well render this bug obsolete, or otherwise change the nature of it. Refactoring the media library now would complicate this process and possibly delay this bug for a long time.
We already consider this issue to be a stable blocker for Media Library, so we are going to get it fixed, but please do not completely refactor it now. It would be a lot more helpful to simply write a test for the proposed fix in #25. As a rule, we don't remove test coverage from core, so if we just add tests, we could be totally certain that whatever we release in 8.7 will not have this bug, even as we refactor the hell out of it.
Comment #27
Pauline G CreditAttribution: Pauline G commentedThe patch still does not work for me, I always have the following error message : "This value should not be null".
Comment #28
jsst CreditAttribution: jsst commentedImplementing #element_validate as done in #19 does fix the issue. It seems hard to write a test reproducing the issue since it depends on contrib functionality (ief or paragraphs). Any thoughts on how a test for issues such as this one looks like?
Comment #29
phenaproximaSure! :) Whatever is causing this bug is probably being triggered by a very specific code path within Paragraphs. If we can figure out exactly what that code path is, we could easily create a test module containing a new form which causes a similar code path to run, thus triggering the error, which would in turn allow us to write an automated test of it.
It seems like #14 came closest so far to explaining the exact reason why the bug happens. Can we build a new form, without using Paragraphs, which would reproduce those conditions? The code doesn't have to be "good"; it just has to do what it takes to cause the bug to manifest itself.
If that's too complicated, a possible alternative approach might be to add the test to Paragraphs itself, which would then cause Paragraphs to fail tests until this is committed to core. We could probably then mark this issue for manual testing. However, that means Paragraphs would be "broken" for an indeterminate amount of time, which kind of sucks. Additionally, that would not prevent core from accidentally regressing. So overall, I think it's better for us to test this in core if it's feasible to do so.
Comment #30
idflood CreditAttribution: idflood at Stimul.ch commentedComment #31
MrPaulDriver CreditAttribution: MrPaulDriver commentedWith Drupal 8.7 Beta 1, I am seeing similar problems top those mentioned in the opening post;
However I am not seeing any validation errors.
I'll leave updating the core version to someone with more understanding, in case my experience is unrelated to this issue.
Comment #32
DrDam CreditAttribution: DrDam commentedWork for me #19
Comment #33
bartnelissen CreditAttribution: bartnelissen as a volunteer commentedAlso getting this error when using the paragraphs browser module
Comment #34
bartnelissen CreditAttribution: bartnelissen as a volunteer commentedAlso getting this error when using the paragraphs browser module
Comment #35
Lukas von BlarerThe patch in #19 works for me with core 8.7.0, but I needed to also apply the patch from #3013171: LogicException Form errors cannot be set after form validation has finished.
Comment #36
BerdirAre you sure this patch is needed at all when using the paragraphs patch? We still need steps to reproduce there, because it worked fine for me with a required entity browser media field/widget, so maybe it is specific to core media library (which is afaik still experimental).
Comment #37
Lukas von BlarerYes, it is specific to core media library.
Comment #38
a.hover CreditAttribution: a.hover at CTI Digital commentedRe-rolled the patch from #19 for 8.7.1.
Comment #39
yogeshmpawarSetting back to Needs Review & triggering bots.
Comment #40
phenaproximaLooks good at a glance, but unfortunately we will still need tests of some sort. :(
Comment #41
Pascal- CreditAttribution: Pascal- commentedPatch in #38 fixed this for me, also had to clear cache after applying the patch.
I was not seeing any errors or messages (except when re-opening the add media modal, then I did see the mentioned message)
Makes it kinda hard to find this issue!
Comment #42
Pascal- CreditAttribution: Pascal- commented#38 patch fixed one issue where I had a required image media field in a paragraph with other required fields as well (title, text)
However in another paragraph type where I only have a required media field, I get the following error:
When removing the required from the media field it works again.
When making it required it breaks again.
The paragraph where it breaks has the media field, tried both image & video, both broke
It also has a few other non-required text fields and a link field
Comment #43
l0ke#38 worked for me even without applying the patch from #3013171: LogicException Form errors cannot be set after form validation has finished
@Pascal- I've tried to reproduce the error described by you in #42 and didn't manage to do it. Could you provide more details on that? And it's not clear from the error what is the actual problem.
Comment #44
AndySipple CreditAttribution: AndySipple commented#38 worked for me.
I tried to duplicate @pascal problem by creating a paragraph with only a media field that references both image and video media types with no success in duplication.
Comment #45
swilmes CreditAttribution: swilmes commentedI can not get #38 to apply clean on Drupal 8.7.3. Will update the patch if I get some time tonight.
Edit: Disregard, human error :)
Comment #46
BR0kENI have no mandatory fields and the following structure:
Node ->
Entity reference revisions
(Paragraphs EXPERIMENTAL
form widget) ->Entity reference
(Media library
form widget).Before applying #13 from #3013171: LogicException Form errors cannot be set after form validation has finished I wasn't able to even open the popup. Now I cannot pick any media item because of error, similar to #42.
Drupal.AjaxError#message
:This happens after hitting the
Insert selected
button. The request goes to/admin/content/media-widget?destination=/admin/content&ajax_form=1&_wrapper_format=drupal_ajax&media_library_opener_id=field%3Afield_admin_dashboard_link_image-field_admin_dashboard_link-0-subform&media_library_allowed_types%5Bimage%5D=image&media_library_selected_type=image&media_library_remaining=1&hash=2c-YqAy5WYYkCs4qq0dH76uqKFS8poTTW74NkE6v0CU&_wrapper_format=drupal_ajax
and the response is what you see in the error message.The problem here is that
Drupal\media_library\Plugin\views\field\MediaLibrarySelectForm::viewsForm()
defines this button with AJAX handler that never triggers:Drupal 8.7.3 with the following patches applied (apart of #38):
Comment #47
bnjmnmHere's a test - the test only patch doubles as the interdiff, as everything else in the main patch is from #38
Comment #48
bnjmnmForgot the @group annotation.
Comment #51
BR0kENI've just copied
media_library
from current8.8.x
branch to the my setup with8.7.3
, cleared the cache and it worked.Comment #52
BR0kENAfter a couple of manual tests I confirm the
media_library
from8.8.x
(commit da6392f87813a9db14550c635cc61ec78e68d67c) allows to select existing media on8.7.3
.Here's the patch for 8.7.3 to update
media_library
to latest (for now) version.Comment #53
bnjmnmChanging issue to current dev version of core
Comment #54
bnjmnmSame as the patches in #48 but reuploading to test against 8.8.x
Comment #55
bnjmnmComment #57
BR0kEN#54 unblocked choosing a file from media library for the required field, so
This value should not be null.
no longer appears.Now I have the following patches in my
composer.json
to make everything work on Drupal 8.7.3:Comment #58
phenaproximaThis is not quite ready for RTBC :) It needs review and sign-off from a subsystem maintainer (myself or @seanB). But don't worry, we'll get this done!
Comment #59
BR0kENProposition: rename the method to
validateFormElement
since it validates the element defined informElement
.Add the
array
type.Drupal CS: two spaces required.
Drupal CS: two spaces required.
This parameter needs to be removed since not used.
Can we add the
array
type for$element
? Thestatic::getNewMediaItems()
has it.Let's use
!empty($element['#required'])
instead, because the#required
key might not be defined.The
!in_array([static::class, 'removeItem'], $form_state->getSubmitHandlers())
duplicates two times per method. It can be the main condition.Comment #60
BR0kEN@phenaproxima, the RTBC was set in a fit of joy, because #54 works.
Comment #61
phenaproximaNo judgment here! I'm the undisputed king of promiscuous RTBCs, so I totally understand the feeling. Now that we have test coverage (and, thanks you to and others in this issue, manual testing and confirmation that it works), I think this will probably be quite straightforward to land; we just gotta put it through its paces. :)
Comment #62
handkerchief#54 works.
Drupal 8.7.5
Paragraph: 8.x-1.x-dev
Comment #63
Jérôme DehorterHi,
I just test #57 patches list on Drupal 8.7.5 + Paragraph 8.x-1.8 and I have an error :
To fix this, a blank line between 2438 and 2439 is needed :
Patch #54 works on Drupal 8.7.5 and Paragraph 8.x-1.8. Thanks
Comment #64
phenaproximaNice work so far. Let's get this thing done!
Let's rephrase this comment. Maybe something like "Only run validation if there is data (i.e., referenced entities) to validate."
This method contains very complex validation logic, so I think we need a longer comment explaining what we're doing here and, more importantly, why. Otherwise this code is probably going to make some future maintainer very unhappy.
$element should be type hinted as an array, here and in the doc comment.
Wouldn't
empty($element['selection'])
be equivalent here?This seems a little awkward. Would it work for us to attach this method instead as a
#validate
handler on every button except the remove button?Comment #65
bnjmnm#59.1 ✅
validateElement
tovalidateMediaWidget
since that is what gets the validation#59.2 ✅
#59.3 ✅
#59.4 ✅
#59.5 ❌
$form
isn't used but it is sent by the callback process so it can't be removed#59.6 ✅
#59.7 ✅
#59.8 ✅ solution is different than what was suggested, but the redundant check is no longer present.
#64.1 ✅ This and pretty much every comment has been thoroughly rewritten.
#64.2 ✅
#64.3 ✅
#64.4 ❌
it's not equivalent but it looks enough like that would be the case that I added a comment explaining why so it doesn't result in the patch getting kicked back.
#64.5 ❌
This won't work (as far as I know) as the validators being triggered are assigned to the element, not the submit element. This has been refactored and commented to make things clearer. Its still possible a better approach exists but perhaps this will help make it more apparent how that would be implemented.
Also Removed some junk from the previous patch that shouldn't have been there - largely stuff related to local testing.
Comment #66
phenaproximaNit: This is a bit dense. I think this might be a bit more readable:
That's my only complaint :)
Comment #68
bnjmnmMade the change requested in #66 and had to make an adjustment to address the fails in MediaLibraryTest as some parent validators make assumptions about the presence of media even if the field is not required. Comment was also updated to reflect this.
Comment #69
phenaproximaThanks, @bnjmnm. You are my hero. RTBC once testbot agrees.
Comment #70
phenaproximaI'm nominating this patch for backport to 8.7.x, since it is a bug fix in an experimental module.
Comment #71
larowlanLooks good, a few questions
I think we should be using the third argument here, because of php's known type juggling issues with in_array - see https://3v4l.org/tAfWE
Should we be using
\Drupal\Core\Render\Element::isEmpty
here instead of the semi-magic 0?Or failing that, should we be using
\Drupal\Core\Render\Element::children
instead of hard-coding 0?should we use `new TranslatableMarkup()` here instead of the \Drupal singleton?
is there a notion of selection handler plugins here? should we be calling the relevant
\Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface::validateReferenceableEntities
instead in case someone wants additional logic on top of the view access check?we're calling this every time, even if we don't change anything? should we only do this inside the if?
⭐️ needs more widget 😉
nit: should we break here once we've found one, no need to keep looping?
should we also add some negative assertions here that we don't see the additional validation errors that spawned this issue?
Comment #72
oknateResponding to the feedback in #71:
Comment #73
oknateMarking as needs work. I believe it introduces a bug. I'm not certain, as it's using the MediaLibraryInceptionWidget.
With the patch, and using the inception widget, with these steps:
Expected: Media inserts again.
Actual: It doesn't insert.
https://www.drupal.org/files/issues/2019-08-07/3003150-regression-720.mov
Comment #74
phenaproximaNice catch, @oknate! ⚾️I think we should add expanded test coverage for that, since in theory MediaLibraryInceptionWidget should be able to do everything the normal one can do. We should also be sure that, somewhere, we have test coverage for MediaLibraryWidget which proves that
...works with it too.
Comment #75
oknateHere's an expanded test that demonstrates the bug.
After I posted this I realized this could use some simplification:
I just need to test that the selection is no longer there.
I think empty($page->findAll('xpath', "(//div[@data-drupal-selector='edit-media-image-field-selection-0'])[1]")) would work.
Comment #76
oknateSimplifying the code mentioned in #75.
I should clarify that this patch is expected to fail, since I forgot the put it in the patch name. This demonstrates the bug in #73.
Comment #77
oknateHere's the rest of the test coverage asked for in #74. This confirms it works with the regular media_library_widget. 🎉!
I started to investigate the bug and found that as far as I can tell, the second selection that fails silently is returning a series of ajax commands that look right to me.
Why is this not doing what it says it's doing? It seems the backend thinks the field has been updated, but the ajax commands fail silently. There are no error messages in the console.
Comment #78
seanBJust debugged this issue. We actually don't need to add the values to the form state in a custom validate function, just limiting the form validation errors conditionally when the field is filled is enough. The problem for empty widget occurs when all validation errors are limited. In this case the unvalidated user input is not added to the form state. For this reason we need to fetch the values from
$form_state->getUserInput()
instead of$form_state->getValues()
.New patch is attached.
Comment #80
oknateFantastic!
Everything looks great. The only thing I saw was this:
There's an extra empty line at after
'#limit_validation_errors' => !empty($referenced_entities) ? $limit_validation_errors : [],
Comment #81
seanBRemoved the extra empty line.
Comment #82
Martijn de WitCame here from #3013035: This value should not be null. This solved the issue using the media library in combination with paragraphs module where a media field inside a paragraph was required. (thank you @seanB for the reference)
Before this patch, the field gave the error: "This value should not be null."
--- edit:
used: #81 with 8.7.x
Comment #83
TheodorosPloumisPatch from #81 works for Drupal 8.7.7.
Comment #84
phenaproximaThis comment is 👍 and makes clear why we are doing this dance. Beautiful. Thank you.
This is also great. I 😍 it.
Frankly, I see nothing to complain about here. RTBC against 8.8.x.
I am concerned about the failure of #81 on 8.7.x, but maybe it was a fluke. I have queued it for re-testing.
I believe this should be backported, since it's not disruptive at all and fixes a problem that many people have encountered. However, if it still fails on 8.7.x, we can address that once this issue hits the "Patch (to be ported)" status.
Comment #85
larowlanThe new tests look to fail on 8.8.x on Postgres, see https://www.drupal.org/pift-ci-job/1416992
NW for that.
Comment #86
larowlanAre there any security implications here?
Comment #87
oknateAttempting to fix the test for Postgres. I don't have it set up locally, so I'm just guessing here:
Curl error thrown for http POST to http://chromedriver-jenkins-drupal-patches-10043:9515/session/2456d240348eb81afedf3d129f9f5f41/execute with params: {"script":"return arguments[0].getAttribute(\"disabled\")","args":[{"ELEMENT":"0.30367707132219235-9"}]}
I think it's this:
$opener->hasAttribute('disabled')
in this$button_enabled = $opener->hasAttribute('disabled') === FALSE;
I refactored the test a bit so that it won't be susceptible to $opener getting stale (I suspect that's what's happening). Also, If we create a wrapper element variable, we can use the more readable 'Add media' button selector.
Also, "(//div[@data-drupal-selector='edit-media-image-field-selection-0'])[1]" is repeated three times, I think a variable will make this more readable.
Comment #88
oknateThe test in question passed on Postgres. The new failure is related to this newly committed issue: #2969678: Integrate Media Library with Content Moderation.
It's failing in HEAD: https://www.drupal.org/node/3060/qa
https://www.drupal.org/pift-ci-job/1417227
https://www.drupal.org/pift-ci-job/1417228
So this issue's test coverage is OK now.
Comment #89
oknateI retriggered the tests for Postgres and SQLite in #87, now that the failure in HEAD has been fixed in #2969678: Integrate Media Library with Content Moderation.
Comment #90
oknateAll tests are now green in #87.
Comment #91
seanBRegarding #86
We have this:
We already expected unvalidated input, so I think we are fine.
Restoring RTBC since the test fixes look good to me.
Comment #92
oknateThis is a minor stylistic thing in the test suggested by @phenaproxima:
It has no functional difference, so leaving at RTBC. I do think we need to explore the security question raised in #86.
Comment #93
larowlanBut now that validateItems isn't always run (correct me if I'm wrong) are we now missing the check on number of values and bundles?
Comment #94
larowlanTo get an answer to #93
Comment #95
seanB@larowlan just double checked. The
#limit_validation_errors
code does not set the values on the form state and for that reason#needs_validation
is not set on these elements. InFormValidator::doValidateForm()
this means the required check is not done on the elements for example.The
validateItems()
method runs as expected since the validation handlers of a clicked button are ALWAYS called. So for our custom validation that only means we have to fetch the direct user input and validate it ourselves.Comment #96
larowlanComment #97
larowlanCommitted f31214d and pushed to 8.8.x. Thanks!
Comment #100
Ankit Agrawal CreditAttribution: Ankit Agrawal as a volunteer and at Axelerant commentedI have recently faced this issue with the media library widget used in the media field of the paragraph (v1.12), got resolved after changing the widget to entity browser.
Comment #101
pbonnefoi CreditAttribution: pbonnefoi commentedSorry to reopen this but I think I found a new problematic case. When deleting multiple media (like clicking on the cross of two medias before the ajax response is triggered) then weirdly it replace the entire paragraph by another paragraph in the page.
Step to reproduce :
- Create two paragraphs field in a node with PARAGRAPH EXPERIMENTAL
- create a media field in paragraphs used in both fields
- Add paragraphs and media to the node
- Save the content
- Edit et remove multiple medias in one paragraph quickly.
=> The paragraph is replaced by another one.