disable submit/save node during ajax-upload

discipolo - October 21, 2009 - 11:49
Project:FileField
Version:6.x-3.x-dev
Component:User interface
Category:feature request
Priority:minor
Assigned:Unassigned
Status:active
Description

still wondering why its so easy to break the node creation when hitting save/submit on nodecreation before filefield uploadstatus reaches 100% cant find any info about this? noone run into this?
am i stupid to believe people will start a file upload and hit save before it is completly uploaded ? can find no obvious/simple way to prevent this?!

it works if i wait for upload field to finish upload before submitting, and also when hitting submit without hitting upload (yet that doesnt show status) Iḿ just wondering if there is a way i can prevent users to hit save before upload is complete

someone must have thought about this: big file in filefield on nodecreation beautiful click upload watch statusbar, click submit before upload complete and node is broken... ?! wtf? there must be a way to prevent

I might be underestimating my users.

it would be great if, in case the user chooses a file and hits save without upload first, the upload would either run in background or show the status.
its also great that i can fill out other fields while the ajaxupload runs and shows progressbar but if i am done filling out extra fields I automatically hit save which causes the nodecreation to break couldnt the save button be hidden during upload?

am i missing something obvious here?

#1

mudd - October 21, 2009 - 21:31

I get this too. In this post I outlined what I did to get around it: #542038: Add another item causes upload, disableFields()? (I only closed this because it's going to take some effort with CCK dev's and 7.0 will be out before much happens with this (??)
Note too that Add-another-item breaks the progress bar for all but the last added field. Tho you can create a node and upload from the default empty field, then add-another and upload, then add-another and upload, etc.. and progress bars work, if you add-another before you upload the original empty field, or add several fields before populating and uploading them, then things start to break. More on that issue here: #491228: Progress bar does not make progress.

#2

rooby - November 16, 2009 - 04:09

Thanks mudd for that code

Here is a .js file with mudd's code in it (it also disables the preview button).
Just add this file to your theme (remove the _.txt part from the file name) and add the following line to your themes info file:

scripts[] = upload_disabled_buttons.js

AttachmentSize
upload_disabled_buttons.js_.txt 1.01 KB

#3

rooby - November 16, 2009 - 09:02

Be careful with that javascript though. Because it looks for any file fields you will run
into problems when you have file fields that don't have an upload button (like on image nodes).

In this case your save buttons will never enable again.

You should modify the js to suit your needs in these cases.

 
 

Drupal is a registered trademark of Dries Buytaert.