Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi guys
Thank you for this awesome component.. It saved me a whole lot of custom code.
I have a quick feature request and I apologize in advance if this has already been discussed.... Rather than display all of the rows in the field, I would like to add some JQuery to dynamically add/delete the rows of the grouping similar to this jQuery plugin example.
http://www.datatables.net/examples/example_add_row.html
Any suggestions or feedback?
Thanks,
Greg
Comment | File | Size | Author |
---|---|---|---|
#19 | 530828-multi_initial_and_per_click.patch | 9.2 KB | SeanA |
#22 | cck-530828-22.patch | 9.72 KB | hitfactory |
#21 | cck-530828-20.patch | 9.72 KB | hitfactory |
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedI'm not sure what do you exactly mean. The multigroup for unlimited number of items already provides a button to add more values, and another button for each subgroup to remove it.
Could you please clarify?
Anyway, I should say I'm afraid I won't have time to add more features here right now. But patches for review are welcome.
Comment #2
gsvitak CreditAttribution: gsvitak commentedHello
Thanks for the quick reply. For my use case, I only want a certain number of rows to be added so I am limiting the number of repeats to 5. I would love the "Add more" to be enabled no matter what the number of repeats is set to but limit the number of times someone could add based on this setting.
Thanks
G
Comment #3
markus_petrux CreditAttribution: markus_petrux commentedOh, I see. Thanks for clarification. IIRC something similar has been mentioned in the CCK queue before, I just don't recall where it was exactly.
Well, I think something like this would have to be implemented first for multiple value fields in CCK2 (it is not strictly exclusive to multigroups), then it would be ported to CCK3, and also implemented for multigroups.
Postponing the issue until someone can come up with a patch for review.
Comment #4
markus_petrux CreditAttribution: markus_petrux commentedBetter title.
Comment #5
markus_petrux CreditAttribution: markus_petrux commentedI just marked #576540: 'Number of repeats' uses 'Add more' button as a duplicate of this issue.
Comment #6
csc4 CreditAttribution: csc4 commentedSubscribing - this might help with default value and required field issues inside the multigroup too
Comment #7
tsi CreditAttribution: tsi commentedSubscribing
Comment #8
markus_petrux CreditAttribution: markus_petrux commentedI just marked #483198: "Number of Values to Display" option for CCK fields as a duplicate of this issue.
Comment #9
afly CreditAttribution: afly commentedcould i add more values in programmatic way ?
for example ,do some magic code in hook_form_alter ?
Comment #10
thekevinday CreditAttribution: thekevinday commentedsubscribing
Comment #11
kobnim CreditAttribution: kobnim commentedsubscribing
Comment #12
avner CreditAttribution: avner commentedsubscribing
Comment #13
acalderon CreditAttribution: acalderon commentedsubscribing
Comment #14
Junro CreditAttribution: Junro commentedSubscribe :)
I have to insert a lot of values in multigroup and I have to click on "add more values" for every row... it's very boring! lol
On the multigroup settings, we should have the possibility to set a number of values to display by default. And if we want more values, here we could use the "add more values" boutton.
Comment #15
giorgio79 CreditAttribution: giorgio79 commentedHello,
I have the same issue as #14, I would like to be able to provide around 100 rows by default, and I don't see how it is possible at the moment, as Multigroup only offers 10 rows or Unlimited, where the user has to add each row.
I would love to have an aribitrary default number of rows, or perhaps provide the number with some php magic, like the keys/values for select list.
(In my case I would like to have one row for each node in content type via node reference...)
Comment #16
giorgio79 CreditAttribution: giorgio79 commentedPosted a separate feature request, as what me in #15 and #14 propose is slightly different but related:
#777574: Custom default value for Multigroup is currently max 10 or Unlimited
Comment #17
bcn CreditAttribution: bcn commentedMarking as a duplicate of #344587: Enable 'add more' button for non-unlimited fields. because that one is older, and has a ~working patch.
Feel free to change back if you think I'm mistaken.
Comment #18
Junro CreditAttribution: Junro commentedNot really the same feature :)
I tried the working patch of the other issue at #17 but it doesn't seem to affect this issue in king of way.
As the title says: it's for non-unlimited field...
This issue is for unlimited field. Instead of adding rows, row by row, we would like to add them 5 rows in on step. Or/and better, choose a default value in the field settings.
Comment #19
SeanA CreditAttribution: SeanA commentedHere's a backport of a patch for 3.x by Agileware that allows 1) setting the initial number of rows and 2) how many rows are added when "Add more" is clicked. Based on the 3.x version found here: #841914: Provide options to set how many fields are initially displayed and how many are added on click of "add more". Contains a database update that adds the new field properties.
"For multiple entry fields it adds options to set how many elements display initially and how many elements are added per click of the add more button. It works when using a limited number of entries or for unlimited." http://drupal.org/node/841914#comment-3209072
Comment #20
Agileware CreditAttribution: Agileware commentedAfter comparing the patch in #19 to the patch at #841914-4: Provide options to set how many fields are initially displayed and how many are added on click of "add more" this issue should be marked as a duplicate of that issue and this patch posted there.
It's easier for people testing and maintainers if the issue is in one place.
Comment #21
hitfactory CreditAttribution: hitfactory commentedPatch in #19 doesn't work as expected for fields. The number of initial fields and the number of fields added when the 'Add more' button is clicked are both one more than the values stored in the field settings form.
Attached patch makes a small modification to the original code from Agileware and SeanA to ensure that values set for 'Initial number of values' and 'Number of values per click' in the admin settings are fully respected.
Patch applies to latest 6.x-2.x-dev.
Comment #22
hitfactory CreditAttribution: hitfactory commentedAttaching again with correct numbering. Patch itself is unchanged.
Comment #23
Agileware CreditAttribution: Agileware commented@SeanA:
This is why it is a good idea to keep this patch in the same issue as the 6.x-3.x branch #841914: Provide options to set how many fields are initially displayed and how many are added on click of "add more"
Because they are essentially the same patch, if a bug is caught in one it should be fixed in both patches (unless it is a regression from your port the bug will almost certainly exist in both patches). The patches need to be kept the same for both branches.
The same patch should be in the same issue.
If you don't want to or have time to, when I get a chance I will get the two patches for the different versions in line and post them both to the same issue.
Comment #24
iMiksusubscribing
Comment #25
SeanA CreditAttribution: SeanA commentedThe bug fixed by #22 is not found in the 3.x version of this feature at #841914. That part of the code is where cck2 and cck3 differ in small but important ways, for example
in 2.x:
$max = ($current_item_count > count($filled_items))
? $current_item_count - 1
: $current_item_count;
and in 3.x:
$max = (!empty($deltas) ? max($deltas) : -1);
while (count($deltas) < $current_item_count) {
$max++;
$deltas[] = $max;
}
Since multivalues are handled slightly differently in cck2 and cck3, it seems to make sense to patch and test this feature (which is dealing with multivalues) separately for each branch. Bugs in one won't necessarily be found in the other.
Comment #26
KarenS CreditAttribution: KarenS commentedThe way this works has already been ported to D7. And that code is frozen. We aren't adding new features in D6 for things that aren't available in D7. Otherwise you will just get started using something that will break when you update to D7.
Unless another maintainer jumps in to back this, this is going to have to be a 'won't fix'.
Comment #27
SeanA CreditAttribution: SeanA commentedIt doesn't matter what code is "frozen" or what version we are talking about, this broken behavior should be fixed.
Comment #28
KarenS CreditAttribution: KarenS commentedA 'feature request' is not 'broken behavior'. It is not 'broken' if you just don't like the way it works. If there is a bug that is something else, I don't see a bug report, I see a feature request. If there is a bug, please clarify what you think the bug is and provide a patch to fix the bug, not add a new feature.
Comment #29
abaddon CreditAttribution: abaddon commented#22 doesnt work with flexifield, i still get 2 flexifields instead of just 1, but it worked for a simple text fieldactually i think this is an issue with flexifield and the way it handles theseComment #30
SeanA CreditAttribution: SeanA commentedI think it's "broken" because it seems to me the only sensible way to implement multiple values is 1) to be able to set how many values are shown initially and 2) how many are added when clicking "add more". This setup covers every use case.
It seems to me the important thing isn't where we are in the D6/D7/D8 development cycle, but whether or not this is a good feature to have for Drupal. Isn't the way things work now the way it's been since D5, since the multiple values feature first got introduced? It wasn't implemented properly in the first place, that's why it's "broken".
Comment #31
KarenS CreditAttribution: KarenS commentedIf we add a way to control that now, in D6, it will work until you try to upgrade to D7, when there will no longer be a way to do it. It won't be added to D7 because this functionality is in core in D7 and D7 is feature-frozen. So unless there is some way to hook_alter the way that D7 works so that a contrib module can add the feature there, it will be something that can only be done in D6.
Comment #32
thekevinday CreditAttribution: thekevinday commentedIt just so happens that the ability to do this via contrib was there in Drupal 7, but they removed it when I pointed out a bug: http://drupal.org/node/1014708
I think hook_field_read_field() and family functions can be used to do this in Drupal 7.
Comment #33
vewakayeh CreditAttribution: vewakayeh commentedIs there a simple way to add a limit, programmatically way, to this Unlimited selection?
for the non-programers maybe this it would be better than trying to convert the old patch #22 to apply on todays version of CCK.
sorry for the bad english:)
Comment #34
SeanA CreditAttribution: SeanA commentedvewakayeh, the patch at #22 should still work for the 2.x branch. It's really not that old and the parts of the code that it modifies might not have changed much, if at all. Have you tried applying it?
Be aware that this is a "dead end" feature however. No upgrade path if you go this route.
Comment #35
vewakayeh CreditAttribution: vewakayeh commentedIt works perfect with version 2.9
and the total values can be extended from 10 to 100 easy with this http://drupal.org/node/680546
(at version 2.9 must be manual but its only one-line patch)
drupal is sooo addictive!!!
Comment #36
eighthourlunch CreditAttribution: eighthourlunch commentedPatch on #22 very nearly works. :)
I'm now seeing "Add another item" on fields where I shouldn't--dates, and non multiple text fields that I don't want to be multiple. I'll see what I can correct.
Comment #37
eighthourlunch CreditAttribution: eighthourlunch commentedOk, I'm sure there's a cleaner way to do this, but this seems to be a good enough short fix.
In /modules/cck/includes/content.node_form.inc, you can use $disabled to change the button type to hidden:
Comment #38
kalimero CreditAttribution: kalimero commentedIncredibly useful patch
Thanks!!!