Needs work
Project:
Drupal core
Version:
main
Component:
field system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 May 2011 at 08:19 UTC
Updated:
28 Jan 2026 at 18:09 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #1
LarsKramer commentedNice idea. Moving to Drupal 8 where feature requests belong.
Comment #2
LarsKramer commentedActually, for the image and file field widgets this has already been implemented. Only one field is shown on the node add/edit form no matter what value is set as the maximum number of fields. So we just need the text field widget to work the same way. Or alternatively, include a widget setting for how many empty fields should be shown initially.
Comment #7
daniel korteAttached is a fix so that limited cardinality fields behave like unlimited cardinality fields.
Comment #9
daniel korteTake two.
Comment #15
guptahemant commentedComment #19
stefaniev commentedThe patch from #9 works for me, on Drupal 9.2.5, thanks!
Comment #21
idiaz.roncero+1 to having this in Core.
Having all the fields already present on the page is bad UX as many users understand the need to fill all the inputs, while the "Add more" pattern is much more user-friendly as it clearly indicates the possibilities (either remain as you are or add a new item).
Comment #22
crmn commentedpatch for drupal 9.3.3
Comment #23
briantschuThe patch from #22 applies to Drupal 9.3.x but is missing some changes that were present in the patch from #9. Adding an updated patch that works with 9.3.x and has all the changes from #9.
Comment #24
marcoscanoThis patch adds the same button the unlimited cardinality fields have, which rebuilds the form element using AJAX.
A different alternative, using clientside JS to hide/show one new empty element at a time, is implemented in this contrib module: https://www.drupal.org/project/sam
Comment #27
very_random_man commentedThe patch in #23 works for me on 9.5. :-)
Comment #28
dpiSeems to me like there might be a lot of crossover between this and #2980806: Fields with unlimited cardinality show 1 extra input field
Maybe both should be triaged into a _Optimising add more button behavior_ issue
Comment #29
anybodyComment #31
jsutta commentedRerolled the patch for Drupal 10.2.0.
Comment #32
jeroentComment #34
jeroentComment #35
anybodyComment #36
smustgrave commentedMoving to PNMI if anyone can confirm #35 is a duplicate, then this can be closed.
If not a duplicate it should move to NW for test coverage and issue summary update.
Comment #37
el7cosmosThis is still missing "Add More" button.
Also, not a duplicate of related issue.
Comment #38
p-neyens commentedHere a patch for D10.2.5 with a fix for "Warning: Undefined array key "#delta" in Drupal\Core\Field\WidgetBase::addMoreAjax() (regel 340 van /var/www/html/core/lib/Drupal/Core/Field/WidgetBase.php)"
Comment #39
el7cosmosUpdated the MR, added a widget option to opt-in
Comment #40
akhil babuComment #41
akhil babuI have added the tests. Ready for review
Comment #42
smustgrave commentedIssue summary still incomplete
Have not reviewed
Comment #43
akhil babuComment #44
akhil babuComment #45
akhil babuComment #46
akhil babuUpdated the IS, Thanks
Comment #47
pameeela commentedGave this a manual test and it looks good. Updated one of the screenshots in the IS which was taken using Gin rather than Claro.
I think these two tags can now be removed too, I reviewed the IS and made some minor tweaks. This would be good to include as a highlight in whatever minor version it makes it into :)
Comment #50
prashant.cThis feature would be beneficial as currently, we are using the contributed modules like
https://www.drupal.org/project/sam or https://www.drupal.org/project/field_widget_add_more to achieve the same.
I am attaching the before and after screenshots of the manual review on the local Drupal 11 instance.
However, I have a few points:
Thanks!
Comment #51
pameeela commented@prashant.c thanks for the review, but note there are already screenshots provided there is no need to add more.
I can see a case for both, as there are definitely situations where you might want the widgets to show. Don't feel strongly either way.
I agree the wording could be more clear, but I don't think that saying "Show 'Add another item' button" is the solution because that still isn't that clear. "Simple Add More" module does the opposite of what's in place here: it makes the behaviour the default but offers a setting to show all elements with the wording:
So I think we can also describe better what the setting does, but I'm struggling with something that is both clear and concise: "Show button to add more values instead of maximum empty fields" (too long) / "Show button to add more values" (short but not as obvious) / "Show maximum allowed values even if empty" (not that clear?)
This is a separate issue - #2980806: Fields with unlimited cardinality show 1 extra input field
Comment #52
prashant.cThank you @pameeela for the detailed response. I was not aware of this #2980806: Fields with unlimited cardinality show 1 extra input field.
Comment #53
pameeela commentedAfter thinking more about this I am leaning toward having it be opt out rather than opt in, because I think it would be more common to want it that not. The reasons to not want it IMO would be if the cardinality is 2 or maybe 3, then I think it probably makes sense to just show the widgets. But in those cases, I don't think it's a problem to have it enabled, and folks could opt out.
The only other consideration is this is a change from the current behaviour that might be unexpected, but I am not sure that is a good reason to have it be opt in.
Comment #54
el7cosmosIf we want this by default, do we need to update the existing field config?
It may also make more sense to have "Show all items"/"Show all widgets" instead.
Comment #55
pameeela commentedI don't think we would want to update existing config, changing the behaviour after the fact would be pretty confusing. I think it only should be enabled by default for new config.
So yeah in that case, I think the boolean is off by default, and we can say "Show empty widgets instead of 'Add another item' button" (or something, feedback welcome) for the label. Ideally the label will make it clear what the setting does without being overly long.
But let's wait a bit and see if there is any other input before making changes.
Comment #56
prashant.cI do not think "Show all items"/"Show all widgets" will make sense because we are not showing all the items at one go, we are providing a way to add another/more item (which is one at a time). So in my opinion "Add another item" is concise and clear to every type of user (technical/non-technical).
Regarding the default enabling option, we may wait for feedback. :)
Comment #57
smustgrave commentedWill need some kind of update path for existing sites. If the setting is unchecked add_more: false should be in the config currently it's empty.
Comment #60
ramprassad commented@smustgrave I have created a new MR (10400) with an update hook in file.install which updates the add_more:false in the form display config for the applicable bundles where these multivalued fields are available. This includes the changes in the previous MR.
My opinion would be to have add_more:true, to have this feature enabled by default to give a good user experience to content authors. Please review and suggest.
Comment #61
smustgrave commentedPlease add to an existing MR vs starting a new when the current is pointing to the correct brandh
Comment #64
ramprassad commented@smustgrave I have updated the existing MR and closed the other one. Please check
Comment #65
ramprassad commentedComment #66
ramprassad commentedComment #67
sagarmohite0031 commentedHello,
Tested and verified on Drupal 11,
MR applied successfully
Attaching before and after screenshot
Comment #68
ramprassad commentedComment #69
ramprassad commentedComment #70
saurav-drupal-dev commentedThe issue is still not fixed for me i had to manually check the 'Show add more button' then the add more
buttonis appearing.Comment #71
ramprassad commented@saurav-drupal-dev Yes this is how its supposed to be for now. By default "Show add more" button will not be checked and we are waiting on the community's decision(pls see #56 to #60). If it has to be enabled, I can update the config as well.
Comment #72
smustgrave commentedLeft comments on MR.
Comment #73
ramprassad commented@smustgrave, I have addressed the comments on the MR, please check.
Comment #74
ramprassad commentedComment #75
ramprassad commentedComment #76
smustgrave commentedComment #77
harivansh commentedComment #78
harivansh commentedComment #79
smustgrave commentedLeft a comment on the MR thanks.
Comment #80
harivansh commentedComment #81
shaxa commentedThe current MR is not mergeable in any other version prior to 11.3.x.
Maybe good idea to have a patch version for 11.1.x, 11.2.x.
Comment #82
shaxa commentedHere is a patch that works for me for 11.2.10
Comment #84
harivansh commentedComment #85
sibustephen commentedThe patch 1156338-add-more-ui.patch implements improved UX for limited cardinality fields. Shows only one widget initially, adds "Add another item” button and respects max cardinality. Tested and working.