Problem/Motivation

When the multi field is set to unlimited cardinality and the validation fails for one of the fields, the form is reloaded only with values for the first row and the rest of the row values are wiped. This does NOT happen when there is a defined cardinality such as 3 or 5 for example.

Steps to reproduce

  1. Create a multi field form element with cardinality set to -1
  2. Assign two fields for it
  3. Set a custom validator for one of the fields
  4. Add a bunch of values, at least 2 or 3.
  5. Enter an invalid value to trigger the validation failure
  6. You will see that the multi field shows only the first set of values filled in and the rest aren't shown

Comments

fathima.asmat created an issue. See original summary.

fathima.asmat’s picture

Patch attached.

fathima.asmat’s picture

Assigned: fathima.asmat » Unassigned
Status: Active » Needs review
teodorakis’s picture

StatusFileSize
new1.42 KB

Fathima, thanks, I confirm that patch resolves the issue.

However, I've noticed another issue when using form element initially. When you select 2 items and click "Add more", it will not add new row for the first time (after the 2nd click it works like it should), because of insufficient information about element state items_count on that moment. I've updated your patch to cover this issue as well.

teodorakis’s picture

Version: 1.0.0-beta4 » 1.0.0-beta6

Status: Needs review » Needs work

The last submitted patch, 4: 3310054-4.patch, failed testing. View results

sardara’s picture

Issue tags: +Needs tests