Active
Project:
Drupal core
Version:
main
Component:
field system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Jan 2012 at 19:45 UTC
Updated:
25 Apr 2023 at 14:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
thomas_rendleman commentedThat would be a nice feature especially when working with large amounts of data.
Not sure how that would work..?
Comment #2
ndeschildre commentedThis is outside of this project (field collection), but I figured out this bit of code may help.
You can use that to add your own #submit function in the "Add another item" button && add/remove as many widgets as you want.
Enjoy!
Comment #3
cola commentedHi all
any other ideas? because the variable $form[$field['field_name']]['und']['add_more'] is not set on my form
regards and thx
Comment #4
cola commentedsolution: use the form_alter to add the submit function
Comment #5
8bitplateau commentedbuilding on the excellent reply #2 by ndeschildre.
Just adding a simple select list of numbers to allow adding x number of items
note, village_ is the custom module name in this case.
I think this is great oppertunity for a little module! something like field_add_x.module ? :)
Comment #6
El Alemaño commentedHi digitisation,
I am trying to use your code, and i will like to do a module with that. But right now is not working right. The Add More button is working just one time, after that you can´t use it anymore. Also will be nice if the select could be together with the submit button. I try to do it like that... but it is not working good. (http://screencast.com/t/kL0PtO5boSlz)
Thanks!
El Alemaño
Comment #7
oryx commentedWorked perfectly for me (core 7.31), thank you so much! I actually called the module field_add_x ;)
Comment #8
8bitplateau commentedhaha - good name.
I came across and issue with recursive field collection though (not a surprise) but I'm sure you can figure it out.
Comment #9
jmuzz commentedThis is controlled by Drupal's handling of unlimited cardinality field items. A solution could be useful for any field but it is by no means a field collection specific issue.
Comment #10
El Alemaño commentedHi,
I was using the "patch" but right now I can not delete any field_collection, because the save button of the form is gone when I delete on item of the field collection.
Any idea how I can fix that?
Thanks!
Comment #11
jmuzz commentedComment #12
davidwbarratt commentedI have no idea what Core 7 is, so moving back to Field Collection.
Comment #13
pepe roni commentedAs stated in #9 this is an issue of the fields module in core, so it is an Core 7 issue.
In general, it is not a good idea to change metadata of an issue with the comment "I have no idea what ... is, so moving back to ..."!
Comment #14
davidwbarratt commentedWell thanks for your rude comment. The metadata was changed with absolutely no explanation, so I apologize for not being able to read people's minds.
Did you know that "Core 7" is a sandbox?
https://www.drupal.org/node/1244394
I'm assuming that's not what you meant?
Changing to the Drupal core issue queue since now I know what the intention was...
Comment #15
shomari commented#2 and #5... Amazing! Thanks for your help. This is exactly what I needed.
I tweaked one line for my own use so that the change is only applicable to field collections
if($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED && $field['type'] == "field_collection"){Comment #16
jmuzz commented@davidwbarratt Thanks for updating the incorrect values. If you're confused about the status of an issue then try reading it's comment history as the information will often be there.
Comment #19
prexa commented#2 and #5 worked for me like a charm ! That's what I was looking for.
Comment #20
lazzyvn commentedHello
I confirm it works with #2 o #5 with edit form but i want add it to field-collection/field-myfield/add/node/xxxx
appear button "add another item" add add multi line to form
how can i do it?
Comment #22
Rom Soul commentedThank you so much !
I was getting crazy waiting for each new item, now I still have to wait but I can create 50 items at a time :D
So if any beginner (like me) wants this excellent piece of code to work, but wonders where to insert it :
you have to create a new module .
And it's a 5mn job if you have an FTP access.
- create folder
site/all/modules/helloworldon your drupal install- create in your folder the file
helloworld.modulecontaining the php code in comment #5replace in the code "
village_" by "helloworld_"- create another file
helloworld.infocontaining :- the module is created : activate it from the modules section
- edit a content that uses a field collection to check if it works
(just trying to summarize... official Drupal 7 documentation about creating modules is available with more details)
Comment #23
kris77 commented#2 and #5 worked for me TOO. I use Drupal 7.56...
I also use only with field collection as @shomari.
Thanks to @ndeschildre and @8bitplateau.
Comment #26
celtech commented#5 is working for me on individual fields. Does anyone know how to get this to work with the Paragraphs module? I need to add multiple Paragraph fields to a node. I am using Drupal 7. Thanks!
Comment #29
gorav.singal commentedI also faced the same issue. I found a helpful article: https://www.gyanblog.com/gyan/drupal-how-add-multiple-fields-single-button/
I also used Paragraphs module. No coding required. This is just awesome.
Comment #35
anybodyJust ran into the same issue and found this one. When having a longer list of items to add, this is really painful and shouldn't be too hard to solve?
While "Add another item" currently has multiplicity of "1", we could instead prefix this button with a number (int) input field, prefilled with "1" in the style of a dropbutton toggle, but instead of havin the arrow part on the right, with a number on the left.
That way it would still be 1 click if only one line is needed, with great UX is more items are needed and it perfectly fits the Drupal UI:

I'm sorry this looks ugly in my screenshot, I'm not a designer ... -.- It should be turned around dropbutton style:

Perhaps someone can sketch that more beautiful? Do you like the idea?
Comment #36
anybody