To reproduce.

- Go to admin/structure/types/manage/article/fields to manage content type fields.
- Click on 'Add field' button.
- Add new field of 'Text(plain) field type.
- Make sure field's cardinality is set to unlimited.

- Go to http://local.d8/node/add/article to create a new article
- Find your newly created field
- Note that your field has more then 1 input fields where it should start with only 1

CommentFileSizeAuthor
#10 two-field-instances.png237.6 KBdrugan
#7 2548711-7.patch612 bytesdrugan

Comments

alx_benjamin created an issue. See original summary.

alx_benjamin’s picture

Title: Adding unlimited field of widget type 'text' to content type will produce a form with 3 dynamic items » Adding unlimited field of widget type 'text' to content type will produce a form with more then 1 input fields
larowlan’s picture

Priority: Major » Normal

I don't think this meets the criteria for major

amateescu’s picture

Status: Active » Closed (duplicate)
alx_benjamin’s picture

Status: Closed (duplicate) » Needs work
Related issues: +#2349819: String field type doesn't consider empty string as empty value

@amateescu This is not a duplicate but the issue you are mentioning is another problem with the same field.
The issue described here speaks about multiple empty input fields before saving node and the ticket you are mentioning is after saving node, while editing existing node. If anything these issues are related but way not the same.

amateescu’s picture

Status: Needs work » Closed (duplicate)

This is a different symptom of the same bug. Try out the patch from that issue if you don't trust me :)

drugan’s picture

Version: 8.0.x-dev » 8.6.x-dev
Status: Closed (duplicate) » Needs review
StatusFileSize
new612 bytes

This issue still exists for any field types with unlimited cardinality. The patch allows to display just one field instance by default.

amateescu’s picture

@drugan, are you sure you're talking about the same issue? Can you post a screenshot with the problem that the patch from #7 is solving?

Status: Needs review » Needs work

The last submitted patch, 7: 2548711-7.patch, failed testing. View results

drugan’s picture

Status: Needs work » Needs review
StatusFileSize
new237.6 KB

@amateescu

There is simple text field added to user account entity. It is displayed duplicated by default on the field default value settings form (which is basically a form of a default form display mode of the entity form). Yes, it is displayed as a single instance on the account edit form but what I am trying to achieve is to render a custom unlimited cardinality field added to commerce_order entity on a checkout pane form using the following approach:

  /**
   * {@inheritdoc}
   */
  public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
    $entity = $this->order->getEntityTypeId() . '.' . $this->order->bundle() . '.default';
    $form_display = EntityFormDisplay::load($entity); 
    $form_display->buildForm($this->order, $pane_form, $form_state);
    $pane_form = $pane_form['field_my_custom_field']['widget'];

    return $pane_form;
  }

As it is a default commerce_order form display mode the field is displayed duplicated the same as on the field settings form.

drugan’s picture

Status: Needs review » Needs work

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Closed (duplicate)
Issue tags: +Bug Smash Initiative

I tested this with Drupal 10.1.x, standard install. I followed the steps in the Issue Summary and could not reproduce the problem.

The problem in #10 is a different problem and should be moved to a separate issue. I created that issue, #3345149: Extra Default value field when adding a field with an unlimited values, moved the patch and added credit over there.

I am restoring the status of duplicate set in #4 and #6