Error in multiple fields of file type

Created on 8 May 2023, over 1 year ago
Updated 31 July 2024, 4 months ago

Problem/Motivation

Hi,

- When a multiple file field is created from the second step, the widget does not come out correctly/normally.
- It only goes wrong in the "Next" form, in the "Back" form it goes right.
- When the file field is in the first step, it works fine. It is only from the second step onwards.

This is a single field and it appears repeated 3 times, it is set as unlimited.
Expected result: Only come out once, not 3 times.

Steps to reproduce

Create 2 steps and in the second step add a multiple file type field.

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡¨Ecuador dmezquia UTC-5

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

Comments & Activities

  • Issue created by @dmezquia
  • πŸ‡ͺπŸ‡¨Ecuador dmezquia UTC-5
  • πŸ‡ͺπŸ‡¨Ecuador dmezquia UTC-5
  • πŸ‡ͺπŸ‡ΈSpain espurnes

    Hello,
    same issue here. It seems related to the step where the image field is placed.

    I have an image field with up to 6 allowed values (cardinality).

    On a form with 3 steps:

    • if the image is placed on first step it works ok, it displays just one input image
    • if the image is placed on second step, it displays two inputs
    • if the image is placed on third step, it displays three inputs

    If I create a fourth step and I move the image field to that step, I get 4 image inputs.

  • Status changed to Needs work 8 months ago
  • πŸ‡ͺπŸ‡¨Ecuador dmezquia UTC-5

    Debugging a little I saw that if the "clone" function is removed from here, it works.

    It is not clear to me if it is really due to cloning the entity or something else.

    For now we would have to continue reviewing.

  • πŸ‡ͺπŸ‡¨Ecuador dmezquia UTC-5
  • πŸ‡ͺπŸ‡¨Ecuador dmezquia UTC-5
  • πŸ‡ΊπŸ‡ΈUnited States jvogt Seattle, WA

    To add to this, it seems like using the Back button sort of resets the count. In my form with the file upload on the fifth step, the following happens:

    1. Click Next 4 times. 5 upload inputs are displayed on the fifth page.
    2. Click Back once. Click Next once. 2 upload inputs are displayed.
    3. Click Back twice. Click Next twice. 3 upload inputs are displayed.
  • πŸ‡ΊπŸ‡ΈUnited States jvogt Seattle, WA

    This proposed patch to the core FileWidget fixed the issue for me: https://www.drupal.org/project/drupal/issues/3276280 πŸ› File widget with multiple values may duplicate empty items Needs work

Production build 0.71.5 2024