Created on 30 October 2023, 8 months ago
Updated 31 October 2023, 8 months ago

Problem/Motivation

When a custom field is assigned X max values, the form presents X empty values. For a high possible max value, having all the fields shown as empty is not that clean UI.

Steps to reproduce

Proposed resolution

It would be nicer to show a "add values" button to add values/records up to the max specified.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Closed: works as designed

Version

2.0

Component

User interface

Created by

🇮🇹Italy Giuse69

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

Comments & Activities

  • Issue created by @Giuse69
  • Status changed to Closed: works as designed 8 months ago
  • 🇺🇸United States apmsooner

    The field settings with cardinality set to limit functions as other Drupal core fields with similar cardinality settings. If for example you set limit to 3 and you are asking to not show 3 blank sets of values, I don't think the fix for that is appropriate here but rather in Core for ALL field types. I think this contrib module may help with that: https://www.drupal.org/project/sam → and there is an issue that addresses it in Core here: https://www.drupal.org/project/drupal/issues/1156338 ✨ Fixed maximum number of field values, but use «add more» similar to when cardinality «unlimited» is used Needs work . I'm going to mark this as closed in favor of the solutions there and hopefully will accommodate your request. Feel free to reopen if there is incompatible with one of those solutions specific to this field but I would assume if it works for other field types, it should work for this one. Thank you for using the module and requesting this feature, I do see the merit for it.

  • 🇺🇸United States apmsooner

    That sam module isn't compatible out of the box but seems it can be by providing a hook to alter fields allowed: https://www.drupal.org/project/sam/issues/3318973 → . You might try this to get it to work. I don't think I would support in the module by default otherwise since the more permanent goal in CORE support would eventually resolve. Best of luck.

  • 🇺🇸United States apmsooner

    If you want to use the sam module, Using this hook in your own module should work. These are the widgets custom_field provides.

    function MY_MODULE_sam_allowed_widget_types_alter(array &$widget_types) {
      $widget_types[] = 'custom_stacked';
      $widget_types[] = 'custom_flex';
    }
Production build 0.69.0 2024