Problem/Motivation

When a required field item is removed and added again, the required validation fails.

Steps to reproduce

Testing with a Text (formatted, long) required field.

Steps to reproduce:
1. Enter text in the field.
2. Click on Remove.
3. Add another item.
4. Enter text and save.
5. Validation for the required field fails.

Issue fork sam-3442879

Command icon 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

minirobot created an issue. See original summary.

minirobot’s picture

Status: Active » Needs review
minirobot’s picture

There is a core issue related to multiple value field validation: https://www.drupal.org/project/drupal/issues/3344082. Only the first item is validated rather than the field as a whole.

I propose that we do not make the first set of fields removable until this is fixed. I've updated the merge request and tests.

marcoscano’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for working on this! I have not tested it myself, but I agree keeping it simple and adding the remove button only for widgets with more than one element makes sense.

RTBC to me, will wait a little bit in case @penyaskito has something additional to add since he reviewed the previous approach, but I'm 👍 to move forward with this.

penyaskito’s picture

👍 I wasn't sure I understood the problem, but @minirobot was patient with me and we huddled about it. Let's get this in :-D

marcoscano’s picture

Status: Reviewed & tested by the community » Fixed

Thank you both! 🙏
Committed and tagged https://www.drupal.org/project/sam/releases/1.2.1

minirobot’s picture

Yay thank you!

Status: Fixed » Closed (fixed)

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