The patch added in #2788607: Empty required fields not providing meaningful error messages assumed the real_item_count still included the removed item. This is not the case in the EXPERIMENTAL widget that updates the field with no "confirm removal" button.

This causes an off by 1 error in the following scenario:
- A field with initially 2 paragraph items.
- Remove 1 item.
- Save the node / parent entity.
- An Error message is shown for "X field is required" even though there is 1 item.

Cause:
ParagraphsWidget::multipleElementValidate():
real_item_count = 1
remove count = 1
Which results in detection of an empty field.

Comments

recrit created an issue. See original summary.

recrit’s picture

Attaching the fix and tests. The test only is meant to fail on the current code base.

miro_dietiker’s picture

Oh this is annoying :-)

But the original code also reads strange, say if there are multiple removals...

Let's get this fixed minimalistically.

Note that we are still thinking about offering something like the remove/undo button again, but we want to progress with cleaning the UI first a bit.

miro_dietiker’s picture

Component: Code » Experimental Widget

  • miro_dietiker committed d15b2e4 on 8.x-1.x authored by recrit
    Issue #2893129 by recrit: Experimental multiple item empty required...
miro_dietiker’s picture

Status: Needs review » Fixed

Committed. Time to get the counts right. :-)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.