Hello
I've spoted this tricky bug while using image_field, but I think that this bug caused by filefield.
Steps to reproduce:
1. Create the multi-valued field for your content type
2. Go to node creation form
- upload 1-st item
- upload 2-nd item
- press "Add another item" and upload 3-rd item
3. Submit this form
You'll see such order in your field:
1. Your 1st item
2. Your 3rd item
3. Your 2nd item
It's because your 3rd item didn't get the correct _weigth while form submit (and gets zero by deffault). I've traced it in filefield_js() function using watchdog before form_set_cache(). While 1st and 2nd items there has correct _weight param (it seens like for item - an array with #such keys), the 3rd equels simple integer there (sorry for my lame explanation).
I spent 5 hours debugging the CCK and filefield (and almost broke my mind :), but didn't succeed in catching the actual reason of this bug. Hope you'll help.
Comment | File | Size | Author |
---|---|---|---|
#5 | filefield.module_.patch | 444 bytes | neochief |
Comments
Comment #1
neochief CreditAttribution: neochief commented(it seems like form item - an array with #such keys) *
Comment #2
drewish CreditAttribution: drewish commentedComment #3
dopry CreditAttribution: dopry commentedThis seems like an upstream issue at first glance... Those weights come from CCK... is this issue exclusively for filefield or does it also affect other field types?
Comment #4
neochief CreditAttribution: neochief commentedIt happens only with file-field widget. This weekend I'll try to finally catch this bug.
Comment #5
neochief CreditAttribution: neochief commentedFinally, I found that this bug is dissapearing when you removing form_set_cache() from the deep of filefield_js() function. It seems that this functions overwrites correct form with some incorrect data and bug is occuring. Anyway, with removing this, nothing seems to be broken and filefield works as ususal.
Here's the patch:
Comment #6
dopry CreditAttribution: dopry commentedDoesn't seem to break anything, drops a line of code... :) committed to head.. tell me if it's better.