Closed (fixed)
Project:
FileField
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
12 Oct 2008 at 20:02 UTC
Updated:
19 Feb 2009 at 04:00 UTC
Jump to comment: Most recent file
When you have multi-valued filefield, and pressing "Add more button" in node composing form, a new value of filefield appears without initialization of default values. For example, if you get your filefield "list by default", any added values to filefield are "not listed" by default.
I've fixed default values in multi-valued file field. There are two source of this bug I found:
1. Incorrect defaults initialization at filefield_widget() function (filefield.module.patch)
2. Incorrect data thrown to filefield_widget_value() function by the CCK's handler (In fact, I'm not sure that my fix don't brake something in CCK. But I've done some tests and everything seems to be fine)
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 320330_default_item_value_2.patch | 510 bytes | amitaibu |
| #4 | filefield-empty-items.patch | 467 bytes | Moonshine |
| content.node_form.inc_..patch | 496 bytes | neochief | |
| filefield.module.patch | 803 bytes | neochief |
Comments
Comment #1
neochief commentedCCK cross issue - #320333: CCK breaks filefield defaults
Comment #2
dopry commentedthe filefield side has been cleaned up... :) thanks for noting the oversight!
Comment #3
Moonshine commentedHmm... I think the patch applied from this issue has caused a problem. $items[$delta] can still come in empty, and is now no longer set to an array of any kind as it was previously:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/filefield/f...
This leads to warnings:
If nothing else maybe we should add something like this back:
Comment #4
Moonshine commentedPatch included...
Comment #5
dopry commented@Moonshine: in what cases does items come in empty?
Comment #6
amitaibuIt comes empty when doing this
However the $element['#default_value'] is empty.
Moonshine's patch seems to work, re-rolled according to coding standards.
Comment #7
pwolanin commentedCan observe the bug this way:
add 2x filefields to a node type (one of them using the image widget). Without the patch I get 2 array merge errors when going to edit a node of that type:
plus the same eorror for line 297
Patch above eliminates the error message.
Comment #8
dopry commentedI figured out another fix... the code base has changed a bit since the last patches were posted.