Fixing FileField, part 4. (Actually, this has little to do with filefield specifically, but I spotted and fixed this while working on it.)
content_multiple_value_form() currently has '#field_name' and '#type_name' disabled, which in turn caused the non-JS submit function, content_add_more_submit(), to employ a workaround of adding a new item to *all* fields when the "Add another item" button is pressed.
I suppose someone didn't know the trick to assign a '#name' to a button so that Forms API can actually tell it apart from other buttons with the same label. Knowing how to make this work, this patch is trivial and causes non-JS "add more" actions to only add a new item to the field where the button was actually pressed.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | cck-3f-1-2-and-4-try2.diff | 4.63 KB | jpetso |
| #2 | cck-3f-1-2-and-4.diff | 4.37 KB | jpetso |
| cck-only-one-more-item.diff | 1.71 KB | jpetso |
Comments
Comment #1
yched commentedcould you roll this one,
http://drupal.org/node/273481 and
http://drupal.org/node/273476 into a single patch ?
Thx.
Comment #2
jpetso commentedHere you are - combined patch of the 3F issues #1, #2 and #4. (Good thing I had them committed to my Git repository in exactly that order, made it easy to roll a diff :D )
Comment #3
yched commentedThanks for this.
Fixing 'add more' for non-JS has been on my todo pretty much since it's been committed, but quite frankly, not on on top. And it got broken completely when the content.node_form.inc split was introduced, without anyone actually noticing it.
Problem with the above patch is that it breaks the long-standing 'provide one empty widget in addition to existing values' behavior when editing an existing node. The 'add more' button will provide one if needed, of course, but you need to click and wait, and I feel people will live this as a regression, so I'd really like to keep this convenience.
I'll try to come up with something, and commit the current patch if I can't soon enough.
Comment #4
jpetso commentedClaiming this issue. I got an improved patch running that should satisfy both my needs and the issue that you mention, I just need to clean up the code a bit more (changed more than was necessary).
Comment #5
jpetso commentedHere you are! If you liked the previous patch, you'll love this one :)
Comment #6
yched commentedBeautiful. Committed. Thanks !
Comment #7
yched commentedComment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.