This should be moved to "file.module" component, whenever it will be available, no

Steps to reproduce the bug

This happens only if using the Javascript feature to upload files. On a clean HEAD install :

  1. Enable "File" module.
  2. Modify the "Article" content type to add a new field of type "File" (I used "Text" and "field_text" as label and machine-name). Use the default values for everything.
  3. Create a node of type "Article" (WITHOUT setting any title), choose a file to upload and click on "Upload". A validation error above the upload form saying that "Title field is required.".
  4. Submit the form, once... the same validation error appears at the top of the form now.
  5. Now, complete the form or leave it as is (without title) and submit it for a second time.

Expected behavior

The node should be saved and I should be redirected to the newly created node.

Current behavor

On the second time you submit this form you are redirected (no matter if the form validated or not...) to a path matching this patterm :
/file/ajax/field_text/zxx/0/form-. And you are facing a white page with the following page, which looks like an AJAX callback :

[{"command":"settings","argument":[{"basePath":"\/"},{"ajax":{"edit-field-text-zxx-0-upload-button":{"url":"\/file\/ajax\/field_text\/zxx\/0\/form-8120b1ac4a4929312b035e18be368c48","event":"mousedown","keypress":true,"wrapper":"edit-field-text-zxx-0-ajax-wrapper","selector":"#edit-field-text-zxx-0-upload-button","effect":"fade","speed":"fade","method":"replace","progress":{"type":"throbber","message":null},"button":{"field_text_zxx_0_upload_button":"Upload"}}}},{"ajax":{"edit-field-text-zxx-0-remove-button":{"url":"\/file\/ajax\/field_text\/zxx\/0\/form-8120b1ac4a4929312b035e18be368c48","event":"mousedown","keypress":true,"wrapper":"edit-field-text-zxx-0-ajax-wrapper","selector":"#edit-field-text-zxx-0-remove-button","effect":"none","speed":"none","method":"replace","progress":{"type":"throbber","message":null},"button":{"field_text_zxx_0_remove_button":"Remove"}}}}]},{"command":"insert","method":"replaceWith","selector":null,"data":"\x3cdiv class=\"messages error\"\x3e\n\x3ch2 class=\"element-invisible\"\x3eError message\x3c\/h2\x3e\nTitle field is required.\x3c\/div\x3e\n\x3cdiv id=\"edit-field-text-zxx-0-ajax-wrapper\"\x3e\x3cdiv class=\"form-item form-type-managed-file form-item-field-text-zxx-0\"\x3e\n \x3clabel for=\"edit-field-text-zxx-0\"\x3eText \x3c\/label\x3e\n \x3cdiv class=\"file-widget form-managed-file clearfix\"\x3e\x3cspan class=\"file\"\x3e\x3cimg class=\"file-icon\" alt=\"\" title=\"text\/plain\" src=\"\" \/\x3e \x3ca href=\"http:\/\/localhost\/sites\/default\/files\/Document Texte_1.txt\" type=\"text\/plain; length=4822\"\x3eDocument Texte.txt\x3c\/a\x3e\x3c\/span\x3e \x3cspan class=\"file-size\"\x3e(4.71 KB)\x3c\/span\x3e \x3cinput type=\"submit\" name=\"field_text_zxx_0_remove_button\" id=\"edit-field-text-zxx-0-remove-button\" value=\"Remove\" class=\"form-submit\" \/\x3e\n\x3cinput type=\"hidden\" name=\"field_text[zxx][0][fid]\" id=\"edit-field-text-zxx-0-fid\" value=\"6\" \/\x3e\n\x3cinput type=\"hidden\" name=\"field_text[zxx][0][display]\" id=\"edit-field-text-zxx-0-display\" value=\"1\" \/\x3e\n\x3c\/div\x3e\n\x3c\/div\x3e\n\x3c\/div\x3e\x3cspan class=\"ajax-new-content\"\x3e\x3c\/span\x3e","settings":{"basePath":"\/","ajax":{"edit-field-text-zxx-0-upload-button":{"url":"\/file\/ajax\/field_text\/zxx\/0\/form-8120b1ac4a4929312b035e18be368c48","event":"mousedown","keypress":true,"wrapper":"edit-field-text-zxx-0-ajax-wrapper","selector":"#edit-field-text-zxx-0-upload-button","effect":"fade","speed":"fade","method":"replace","progress":{"type":"throbber","message":null},"button":{"field_text_zxx_0_upload_button":"Upload"}},"edit-field-text-zxx-0-remove-button":{"url":"\/file\/ajax\/field_text\/zxx\/0\/form-8120b1ac4a4929312b035e18be368c48","event":"mousedown","keypress":true,"wrapper":"edit-field-text-zxx-0-ajax-wrapper","selector":"#edit-field-text-zxx-0-remove-button","effect":"none","speed":"none","method":"replace","progress":{"type":"throbber","message":null},"button":{"field_text_zxx_0_remove_button":"Remove"}}}}}]

If the form validated correctly (if you set the title), the node is indeed saved correctly, but you are still facing this bug.
Not only the workflow of uploading a file is broken (It should not tell me the title is missing when I only submitted the upload form... it find this misleading) but it breaks the form.

Comments

TheRec’s picture

Oh, and just to be sure, I've tested this on Windows and Linux servers (since file upload are sometimes behaving differently), the bug is present on both.

ocking’s picture

Hi TheRec, thx for ur steps to reproduce the problem.
I'm also facing this problem but I can't googled out the resolution. how can we get rid of the bug ?
mine is a fedora9 box (APC enabled)
Apache/2.2.9 (Fedora)
drupal 6.14
Mime type detection=UNIX 'file' Command
MySQL database 5.0.51a
PHP 5.2.9
PHP memory limit 128M
* post_max_size=8M
* upload_max_filesize=8M
* max_execution_time=1000
* max_input_time=1000

FileField 6.x-3.2
...

many thx

P.S. http://drupal.org/node/357400 can't help

marcingy’s picture

Status: Active » Closed (fixed)

can not recreate in head.