1/ Make sure "multiple values" is disabled
2/ Upload a file. The filename is now entered in the description field
3/ Upload a new file. The description field remains the old filename and is not updated to the new filename
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | filefield-reset-description-try2.patch | 2.46 KB | jpetso |
| #9 | filefield-reset-description.patch | 2.46 KB | jpetso |
Comments
Comment #1
brunodboI'm having a similar problem: when I upload a file and change the description to something different than the file name, the description is not updated. Instead, it's still showing the file name.
For instance, when I upload a file called 'foo.pdf', that file name is displayed, even though I entered 'lala' in the description field.
Comment #2
jpetso commentedCan you verify that bug for the 2.x release, please? No idea if it's still in there.
Comment #3
ivrh commentedI am using version 2.2 and this bug is there.
Moreover, when I edit created node and change description field to something I want to be displayed - it works, but I need to edit the node again. When creating a new node with file upload field - it fills "Description" field with filename, no matter if I enter "Description" manually (it just ignores my input). Editing the node fixes it.
Comment #4
ivrh commentedIT WORKED FINE WHEN AJAX UPLOAD FAILED.
Something failed with AJAX file upload and it caused page refresh to upload a file. When the node was submitted - Description was in place instead of usual filename. So, I presume this is AJAX or session variables (or both - depending of now the Description and filenames are stored temporarily).
Comment #5
jpetso commentedThanks for testing, the status can now be pushed back to 'active' again. Let's see when I can find time to get this fixed.
Comment #6
jpetso commentedArr! Didn't I want to change the status? ...
Comment #7
dopry commentedThis bug only seems to happen with ajax uploads disabled on single value fields... I have a feeling the #default_value doesn't want to get updated. It doesn't really both me as I do ajax only sites in general....
Any one got this itch to scratch? I'd like to see it closed before I release 2.3.
Comment #8
jpetso commentedYou're right, it seems like Form API plays a trick on us again. #default_value is being written correctly the second time as well, but seems to be overridden by the value that has been "entered" when uploading the previous file. Let's see if I can figure out a remotely clean fix for this...
Comment #9
jpetso commentedYo, I did it.
dopry, please review the attached patch and see if it's ok from the coding point of view.
Remaining audience, please apply the patch on your filefield and tell me if it fixes the issue for you.
Hope you like it!
Comment #10
jpetso commentedBetter patch, using the file path for comparison, not its name. (Using the file name was a remainder of comparing with the description, which I also tried.)
Comment #11
dopry commentedLooks good a little byzantine to keep a text field sane, but oh well it does the job... but commit that when you feel like it... I'll try to get around to commits in a couple days, but I'm in mid travelling at the moment.
Comment #12
jpetso commentedWell, byzantine... looking at form.inc, I couldn't see any way to enforce the '#default_value' being displayed instead of the submitted value. So we would either need something like the above patch, or change the form element name from 'upload' to something that is unique for each newly uploaded file - which has the potential to be cleaner, but also needs extra code (in other places).
I didn't commit it before because I wasn't sure if you like the above approach... if it's not clean enough, I can also try out if the other one is doable.
Comment #13
dopry commentedno whats there is fine.. :)
Comment #14
dopry commentedcommitted to DRUPAL-5--2
Comment #15
dopry commentedcommitted to DRUPAL-5--2
Comment #16
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.