When adding a new element to a form, if the key already exists within the form, then the new element overwrites the existing element.

This occurs when key is explicitly set (like for Flexbox) or is dynamically created from title of element (like for Text area).

I would have hoped the system would add a number to the end of key to make it unique (like "_2") or at least stop the adding of the element and display a message stating the key already exists.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danjordan created an issue. See original summary.

jrockowitz’s picture

Assigned: Unassigned » jrockowitz
Priority: Normal » Major
Status: Active » Needs review
FileSize
2.99 KB

This is a major issue. The attached patch prevents duplicate elements from being created.

  • jrockowitz committed b7263dd on 8.x-5.x
    Issue #2882060 by jrockowitz: Creating a new element to a form with same...
jrockowitz’s picture

Status: Needs review » Fixed

I committed that patch. Please download the latest release to review.

danjordan’s picture

Tested and works great. Thanks Jacob

Status: Fixed » Closed (fixed)

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