Don't add an empty element in some cases

Created on 19 February 2021, over 3 years ago
Updated 31 May 2021, over 3 years ago

Problem/Motivation

When the multivalue element is disabled, input is impossible, so no empty item should be added to the element.

Steps to reproduce

Add a disabled multivalue element to a form.

Added in third commit:
Add an extra option #add_empty (supposed to be 1 or TRUE by default) which can be set to 0 or FALSE to not add extra items, also when the element isn't disabled.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇧🇪Belgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium HnLn

    This patch does apply on beta6, but throws a notice:

    Warning: Undefined variable $max in Drupal\multivalue_form_element\Element\MultiValue::processMultiValue() (line 234 of modules/contrib/multivalue_form_element/src/Element/MultiValue.php).

  • 🇷🇸Serbia super_romeo Belgrade

    Same thing with dev-version.

Production build 0.71.5 2024