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?
Comment | File | Size | Author |
---|---|---|---|
#10 | filefield-disable_submit_buttons-610462-10.patch | 1.06 KB | rooby |
#5 | filefield-610462-5.patch | 1.4 KB | rooby |
#2 | upload_disabled_buttons.js_.txt | 1.01 KB | rooby |
Comments
Comment #1
mudd CreditAttribution: mudd commentedI 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.
Comment #2
rooby CreditAttribution: rooby commentedThanks 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:
Comment #3
rooby CreditAttribution: rooby commentedBe 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.
Comment #4
quicksketchI'd be happy to include these changes directly in FileField if a patch can be provided. This is one of the things that was on the wish-list but just was never implemented.
Comment #5
rooby CreditAttribution: rooby commentedHere is a quick patch for this.
It's based on #2 with a couple of changes.
It doesn't suffer from the problem mentioned in #3.
It currently disables the save/submit, preview, delete & add another item buttons.
Feel free to change which buttons are disabled to suit the requirements.
[EDIT] It's against 6.x-3.x-dev
Comment #6
pumpkinkid CreditAttribution: pumpkinkid commentedHas this been included in any version of filefield yet?
Comment #7
quicksketchNo, if it had been, it would be marked "fixed". You can help by applying the patch and reviewing its behavior. Generally it looks pretty good, though there are some semantic problems, we shouldn't be using names like "waitSave", it should be namespaced into "filefieldWaitSave". I'm also not sure about the approach, it looks like this would disable the save and preview buttons just by selecting a file, not uploading one. Additionally a name like
$('#edit-field-file-field-file-add-more')
is hard-coded, meaning this will only work if you name your field "field_file".Comment #8
pumpkinkid CreditAttribution: pumpkinkid commentedI will look into it and let you know what I find. Thanks for your response!
Comment #9
hatsch CreditAttribution: hatsch commentedthis works far better then the current default behavior.
i don't have multiple files so i could only test the upload button.
it's true that the save/preview buttons are disabled as soon as a file is selected. would be better if pressing the upload button would be used as a trigger.
Comment #10
rooby CreditAttribution: rooby commentedI just had a quick look at this again.
What about something like this.
It is extremely generic compared to the previous one.
It disables all input elements of type submit and it works based on clicking the upload button.
Comment #11
braindrift CreditAttribution: braindrift commentedHi,
for me this patch looks great.
Additional it would also be great, if all the buttons would be disabled as soon as a file is selected, so the user is forced to push the upload button before he can hit the save button.
Is it possible?
Thanks
dendie
Comment #12
rooby CreditAttribution: rooby commented@dendie:
The functionality of disabling on the click of the upload button was what was recommended by the module quicksketch (the filefield maintainer) in #7.
Off the top of my head I'm pretty sure that clicking submit before you have clicked upload doesn't cause any problems.
Clicking submit during upload does cause problems, which is what this patch aims to resolve.
So that functionality might not be something the module will provide out of the box, but you could add it to your site specifically is you wanted.
But ultimately it's up to quicksketch if it is to get in this patch.
Comment #13
quicksketchI'm not sure disabling all buttons is a good approach either. Some users like to make 6 file upload fields and then upload them all at once. Uploading a file also shouldn't do things like prevent you from using the Teaser Splitter or adding more fields to other CCK fields.
In any case it looks like the current patch doesn't ever re-enable the buttons at all, so I'm moving back to needs work.
Comment #14
carvalhar CreditAttribution: carvalhar commentedwell, i think #10 is a nice add-on.
If users will or won't like this feature, is something that should be added as a configuration option.
I also used the code from here:
http://drupal.org/node/540138
Comment #15
JordanMagnuson CreditAttribution: JordanMagnuson commentedAnyone know how to accomplish something like this in Drupal 7 with build-in file field?
Comment #16
iiioufmaniii CreditAttribution: iiioufmaniii commentedHey,
On drupal 7 I use a hook_form_FORM_ID_alter(&$form, &$form_state, $form_id) where I put
$form['#attached']['js']['PATH-TO-JS/disablesubmit.js'] = array('type'=> 'file', 'weight'=>'1');
to attache disablesubmit.js code.
And disablesubmit.js is :