I installed CCK and FileField on a fresh install of Drupal 6.3 to completely rule out any interference from other modules, and there are still two errors. One is FileField not uploading files when no extensions are defined (which is covered in other reports). The second bug, which this report is for, is that it will only allow files to be uploaded or removed (when editing content with a file field) if all the required fields are filled out. If all the required fields are filled out, it will upload (or remove) the file, but all the fields (including non-required ones) are wiped after the operation (i.e. they're blank when the creation form reloads to reflect the uploaded/removed file).

I hope this report is useful.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eojthebrave’s picture

Status: Active » Needs review
FileSize
531 bytes

This patch sort of fixes the problem. It allows you to upload your files without filling out required fields. It still tries to validate all the form fields, and gives you errors for those that are not filled out, but still uploads the file.

[edit] For clarification: It looks like the problem is that the node object never gets rebuilt after submitting the form and uploading a file, so although the file does get uploaded it was not being displayed on the form because it hadn't been incorporated into the node object.

drewish’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
701 bytes

tested and this works. looking around core it seems that all the node submit buttons are either using this as their #submit callback or their submit callbacks are calling it.

re-rolling to fix the indenting

dopry’s picture

Status: Reviewed & tested by the community » Fixed

committed to HEAD.

Deciphered’s picture

Just a heads up, removing a file still wipes all fields.

william_frane’s picture

Status: Fixed » Active

Just a heads up, removing a file still wipes all fields.

Also, a file can still only be removed if all the required fields are filled out.

it seems that all the node submit buttons are either using this as their #submit callback or their submit callbacks are calling it.

Does this mean it's not possible to remove the "... field is required" messages when a file is uploaded? This didn't occur when uploading files with version 6.x-1.0-beta2.

I'm going to tentatively switch this back to "active" status; although the "... required" message isn't a technical problem (it doesn't affect functionality), the wiping of all fields when a file is removed is, at least from my point of view. A fix for this issue would be capital.

drewish’s picture

Status: Active » Needs work
FileSize
649 bytes

this fixes the problem with clearing the node after clicking remove but you still can't remove a file unless all validation passes.

william_frane’s picture

I just updated FileField today (July 31st, about 5 minutes ago), and it appears that most of the issues discussed in this thread are either still present or have returned since I last updated (on July 29th; if I recall correctly some of them were fixed in this update).

To be precise:
- All required fields must be filled out in order to upload or remove a file (it's back to the behaviour where a file doesn't show up/disappear after an upload/removal unless all the required fields were filled out)
- When a file is uploaded or removed, the title field is wiped (this is better than all the fields getting wiped, but still a problem)

drewish’s picture

FileSize
636 bytes

the fix for #287946: Uploading Image wipes Multiselect field involved backing out these changes but dopry thought that this was still working.

update: re-rolled the patch to add the node_form_submit_build_node() call. i don't have any multiselects so it's not a problem for me but the validation problems are.

dopry’s picture

Status: Needs work » Fixed

this is fixed in HEAD.. taxonomy still getting wiped out.. we need js handlers to fix that.. they're next.

drewish’s picture

william_frane’s picture

Version: 6.x-3.x-dev » 6.x-3.0-alpha1
Status: Fixed » Active

Filefield (6.x-3.0-alpha1) still displays an error message if required fields aren't filled out when uploading a file, but will upload the file. Also, it won't remove an already uploaded file if the required fields aren't filled out.

Deciphered’s picture

Version: 6.x-3.0-alpha1 » 6.x-3.x-dev
Status: Active » Fixed

@william_frane

It says fixed in HEAD, not fixed in 6.x-3.0-alpha1. It will never be fixed in 6.x-3.0-alpha1. If you don't want to download the dev build you'll have to wait for another official release.

Steve Dondley’s picture

Status: Fixed » Active

I just upgraded to head (cvs -b HEAD update) and I'm still seeing this issue.

Steve Dondley’s picture

I should be more specific, here, because I posted here because of the last note at http://drupal.org/node/287946

The behavior I'm seeing is that my mult-select taxonomy control selects get wiped out after hitting "upload".

dopry’s picture

FileSize
942 bytes

this issue will persist until I can get ajax uploads working. i've been having a really tough time with the ahah callbacks and I don't particularly feel like committing breakage to HEAD at this point... When I enable the ahah callbacks, I get the proper post when the ajax upload is initiated with no files to be uploaded. however if I try to upload a file i get not _POST in my ahah callback... It's really starting to drive me insane since my JS/jQuery debugging skills are passable, but still a little shy of expert. I don't really know what is happening with my posted data... attached is a patch for the current state of the AHAH callback.. I would really love to see post data in the request or at the server.

dopry’s picture

Status: Active » Fixed

fixed in HEAD.

korayal’s picture

FileSize
24.72 KB

I'm getting this when I try to upload an image.

An HTTP error 0 occurred.

check the attachment.

(also http://drupal.org/node/286402#comment-958291 )

dopry’s picture

if you've upgraded rebuild your menus. If you're using devel.module disable it.

dopry’s picture

I've just committed an update that should block devel module interference.

korayal’s picture

I've already disabled devel. by "rebuilding menus" do you mean clearing the menu cache?

alanburke’s picture

Well, you can now continue to use Devel module since the last commit by Dopry.
There is a link in the Devel module called 'Rebuild menus'.

That should do the trick.

Regards
Alan

korayal’s picture

Yep It worked now. Now my only problem is with imagefield :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.