Closed (fixed)
Project:
multiadd
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 Dec 2011 at 18:49 UTC
Updated:
13 Jan 2012 at 09:10 UTC
Jump to comment: Most recent file
When you add more than one set of fields grouped as a multiadd item you currently get a single remove button at the bottom of the list next to the add button that allows you to remove one from the list. You don't get to choose which one though, it just pops the last element off the end of the list. It would be better if you could choose to remove a specific item (set of fields & their corresponding values) from the list instead.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1382196-1-multiadd-remove_per_item-eojthebrave.patch | 7.36 KB | eojthebrave |
Comments
Comment #1
eojthebraveAnd here is a patch. Adds a remove button to each set of multiadd fields when there is more than one of the given set of fields.
Question. Should we have the ability to remove the "last" set of fields. Should there be a remove button if there is only one set of fields? Maybe in that case it just blanks the values for those fields?
Comment #2
sidharth_k commentedThis patch is awesome Joe! We needed this functionality!
Have been busy with the rest of the candidate application since I got back Monday. Will review and merge soon.
Comment #3
sidharth_k commentedThe logic is okay and this works properly for normal drupal forms. Unfortunately it seems to fail for ctools multistep forms.
Unfortunately some caching (or something else?) seems to be happening. While #default_value is correct the #value is always the old one.
multiadd_process returns the correct $element. But somewhere in the form processing chain something is going wrong. I'm trying to modify the code a bit to get this to work but no luck yet.
Comment #4
sidharth_k commentedCommitted in http://drupalcode.org/sandbox/sidharth_k/1349098.git/commit/75a3e5b
Thanks again Joe!
Related commits:
- Remove button per item should now work on ctools multistep forms
http://drupalcode.org/sandbox/sidharth_k/1349098.git/commit/037bcb6
- Remove the multiadd_remove button during submit phase This is so that the button values don't get persisted when the multiadd values are serialized
http://drupalcode.org/sandbox/sidharth_k/1349098.git/commit/25ae73d