Closed (fixed)
Project:
Paragraphs
Version:
8.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
23 Aug 2016 at 12:03 UTC
Updated:
27 Aug 2020 at 08:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
andy_w commentedThis patch seems to resolve the issue.
Comment #3
johnchqueSounds reasonable and nice, let's see what test bot has to say :)
Comment #7
andy_w commentedRefactored out to two separate validation methods to prevent the delta issue
Comment #8
johnchqueLet's see test bot again, please set the issue as needs review when upload a new patch. And also an interdiff would be useful.
Comment #9
andy_w commentedRefactored this to avoid altering the initial elementValidate (no requirement for this), and to avoid checking for an irrelevant error.
Comment #10
johnchquewrong indentation here. Besides that looks nice.
can we get some example screenshots?
Comment #11
andy_w commentedFixed incorrect indentation & include a screenshot of the relevant error message. This message simply replaces the old standard error message so should appear as that error did, screenshot included.
Comment #12
johnchqueI tested manually a bit and seems to work nicely, the only problem I found so far is that when a paragraph with a required field is added and we have paragraphs in the same level with display mode as 'closed', we don't fill the required field of the new paragraph and we open and close the previously created paragraph it doesn't allow the user to close the old paragraph pointing to the required field of the new paragraph.
Comment #13
miro_dietikerAnd yeah, we need the tests. :-)
Comment #14
ModernMantra commentedProviding test coverage...
Comment #15
pradeep22saini commentedPatch works fine.
There is one more update needed.
When viewing the edit form for Paragraph. It doesn't show it as required. It should show "*" red asterisk for required paragraph field.
Comment #16
pradeep22saini commentedComment #17
pradeep22saini commentedUpdating class "form-require" changes for require paragraph fields.
Comment #18
michellere #15, there is a patch for that here: #2820502: Add form-required to required paragraph fields. If that will be included in this patch, then that one can be marked dupe.
Comment #19
drholera commented#17 Looks good for me
Comment #21
arpitr commentedDoes not seem to get the #17 patch applied, I did a manual patch using #17 and here goes the patch as attachment.
Comment #23
johnchque@arpitr it seems your dev branch is way below the current dev. Let's retest #17 and see if it passes now.
Comment #24
arpitr commentedI realised after uploading the patch and when I saw the diff, please ignore #21
Comment #25
cyb_tachyon commented#17 works for me against latest dev. (2/3 Community Reviews).
However, some coding standards need to be addressed (will roll a patch if I get time).
old mode 100644 / new mode 100755
+ '#max_delta' => $max-1,should be+ '#max_delta' => $max - 1,+ * Validate multiple element items.should be+ * {@inheritdoc}+ * Tests displaying error message on empty paragraph required field.should be+ * {@inheritdoc}+ }should be+ }\nComment #26
cyb_tachyon commentedComment #27
cyb_tachyon commentedComment #28
cyb_tachyon commentedComment #29
zerolab commentedComment #30
johnchqueWe need this fix and test in the experimental widget too.
Comment #31
ModernMantra commentedRerolled the patch because of recent commit, as well extended the patch to experimental widget (also added test coverage). Hope it is ok :)
Comment #32
miro_dietikerI like it how this is combining the two cases of the form elements, although only very few lines are won.
The #title should not be set on this level in the second case, or at least wasn't before.
Applies to both widgets.
I don't think we should create an empty string item here. Make the variable an array with empty default.
Comment #33
VladimirMarko commentedComment #34
VladimirMarko commentedFixed that.Disregard the above. It's a patch for an entirely different issue.
Comment #35
VladimirMarko commentedComment #36
VladimirMarko commentedComment #37
VladimirMarko commentedThis should fix it.
Comment #43
wiktorb commented#37 works fine - tested with both classic and experimental widget
Comment #44
johnchque#37 is now working, instead the test-only should fail.
Comment #45
VladimirMarko commentedComment #48
johnchqueAs discussed let's move the test to a new class for the UI. :)
Comment #49
VladimirMarko commentedMoved the tests to a new class, as discussed.
Comment #52
VladimirMarko commentedConverted to use only short array syntax.
Comment #57
johnchqueNext time be careful with interdiff name. Besides that looks good. Any complaint for RTBC it?
Comment #58
ssibal commentedThere is still a case where this meaningless error message appears:
Steps to reproduce:
1. Create a content type
2. Add a required paragraph field to the content type
3. Create a content item of that content type
4. Create a paragraph type item and remove it but don't approve the removal
5. Try to save the content
Expected result:
Error message: "{Field name} field is required."
Actual result:
Error message: "This value should not be null."
Comment #59
VladimirMarko commentedGood catch, @ssibal! I will fix it.
Comment #60
VladimirMarko commentedI fixed that case, but did not extend the tests to cover it yet.
Comment #64
jeroentFixed failing test.
Comment #65
jeroentComment #66
VladimirMarko commentedExtended the test coverage.
Comment #69
ginovski commentedThis function should have its own documentation, there is nothing from {@inheritdoc}
Same for the one in ParagraphsWidget
Comment #70
VladimirMarko commentedAdded the missing method documentation for
multipleElementValidate.Comment #71
a.milkovskyThe patch #70 forks for me. +1 for RTBC
Comment #72
toncic commentedWe don't need this.
Hmm, this is OK but maybe we can change this a little bit and do on the way which is more common for us with $edit, the same as you did in next few lines. I think will be more readable.
Comment #73
VladimirMarko commentedImplemented the changes.
Comment #76
toncic commentedI would say "class" instead of "classes".
Unrelated change.
Maybe to create helper method and put these code there. Would be nice if we can send mode as a parameter and make it to works for all modes.
The line is so long. Split it in multi lines, drupalGet('.....') before $edit.
Comment #77
VladimirMarko commented1. As discussed: It's an array that contains classes. (One or none, in this case.) We commonly just use plural for those, in Drupal. As in:
$file = current($files);, even if we know that there is just one file in$files.Implemented the rest.
Comment #80
toncic commentedExtra space before ';'.
Separate the @param and @return sections by a blank line.
Type hint "array" missing for $widget_state.
Still unrelated change.
We have static function ''fieldUIAddNewField'', maybe you can use it.
Separate the @param and @return selections by a blank line.
Comment #81
VladimirMarko commented4. Removed from that class as well.
5. Great suggestion! Implemented.
Implemented everything.
Comment #84
toncic commentedLooks fine now.
Comment #85
spadxiii commentedQuick test: the error message now indeed shows the field label. But the field itself is not marked as an error.
Comment #86
recrit commentedre-rolled patch against the latest dev 31fe6df since it was not applying.
Comment #88
miro_dietikerCommitted, thx, lots of attributions. :-)
Still authoring @andywhale as the original fixing logic came from him.
Comment #90
mbm80 commentedFor those who are locked in paragraphs to v1.1 and want to use the patch i had to adapt the 86 patch a bit, just removed the assert in ParagraphsConfigTest.php since the method is missing.
Comment #91
finex commentedHi, the bug is still reproducible on current -dev version. If you have a required field on a paragraph and you save the node the message error is:
Comment #92
finex commentedComment #93
ankit agrawal 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.