Don't add an empty element in some cases

Created on 19 February 2021, over 3 years ago
Updated 31 May 2021, about 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).

Production build 0.69.0 2024