I'm using the Mupload module to add multiple plupload elements to a node form, however the current plupload.js files submit handler does not work very well if you have more than one plupload element in your form. Attached is a patch to fix this issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

slashrsm’s picture

Status: Needs review » Postponed (maintainer needs more info)

Can you describe which errors you encounter while having multiple Plupload elements on a form? I tested it on a node form with 2 image fields with Mupload widgets and I was unable to reproduce any issues caused by the fact that there are multiple widgets on a form.

nbucknor’s picture

Only the first Mupload widget would submit correctly if you try to submit the form without clicking upload on each of the widgets. My patch tests to see if all widgets have completed their uploads before submitting the form. Previously the form would submit once the first widget has completed its upload.

slashrsm’s picture

Status: Postponed (maintainer needs more info) » Needs work

Oh... sorry. Now I get it...

It looks like it works and fixes the bug. Could you add Drupal.t() around strings?

nbucknor’s picture

Status: Needs work » Needs review
FileSize
6.55 KB

Patch with Drupal.t()

annblack’s picture

I hit the exact same issue and had created a local fix. However, I like nbucknor's fix better. Thanks! I re-spun the patch so that it can be applied on top of beta4. It would be great if the fix can be integrated in.

slashrsm’s picture

Status: Needs review » Fixed
slashrsm’s picture

Status: Fixed » Needs work

Previous commit caused an unnecessary popup saying "Please wait while your files are being uploaded." on every submit. This should be removed by this commit: http://drupalcode.org/project/plupload.git/commit/3407285

I also think that errors currently do not work OK, if we have multiple errors on multiple plupload elements at the same time. It looks like the last error will overwrite all the previous ones. Since this should be fixed I mark this as "needs work".

nbucknor’s picture

I agree that error reporting with multiple plupload elements needs a lot of work. In my patch, I had a list of errors indexed by each element and separated by linebreaks. Somehow that got mangled in your commit to dev.
See below:

else if (uploader.files.length == 0) {
    errors += Drupal.t("@index: You must upload at least one file.\n",{'@index': (index+1)});
}
slashrsm’s picture

Status: Needs work » Needs review
FileSize
1.07 KB

You mean like this?

nbucknor’s picture

yup, but notice it should be index+1 instead of index1 for the text replacement bit.

errors += Drupal.t("@index: You must upload at least one file.\n",{'@index': (index+1)});

slashrsm’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

liquidcms’s picture

Status: Closed (fixed) » Active

was this actually fixed? i have 1.1 and i cannot get 2nd plupload field to work - if i drag/drop an img to that field it simply displays the img full screen and if i drag an img into the first plupload field it adds it to both fields (as ready for upload).

liquidcms’s picture

tried the 1.x-dev as well and also does not work

slashrsm’s picture

Status: Active » Postponed (maintainer needs more info)

This is included in 7.x-1.1. This patch was mostly about error handling and making form aware of more Plupload elements.

The issue you report might be Plupload's issue. Have you checked their issue queue?

liquidcms’s picture

hmm.. ok, to be honest i took over dev on this project and didn't realize that plupload was an ext library - although on your project page you state:

Drupal 7 version provides Plupload library and form element.

i guess that is not correct? i need to d/l plupload myself and perhaps i do not have the latest.

liquidcms’s picture

i checked and i had version 1.5.1.1 of plupload lib; not sure which version i am supposed to have but i grabbed latest (1.5.6) and it does not help the issue.

slashrsm’s picture

Have you searched their issue queue?

Will correct the text on project page.

liquidcms’s picture

not much in their queue. i started using the mupload module which i think also uses plupload and it seems to work.

slashrsm’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Mupload dpends on this module. :) Could you check your code once again? Maybe you have to change ID's of your elements to prevent collisions.

slashrsm’s picture

Status: Closed (works as designed) » Fixed
liquidcms’s picture

my code? i have not added any code anywhere.

slashrsm’s picture

What module were you using in #13?

liquidcms’s picture

lol.. i'm confused. i was using this module - that's why i posted against this project.

slashrsm’s picture

This is API module. You have no use from it unless you write your own code or use another module that depends on it. See project page for list of those.

liquidcms’s picture

ahh, sorry, i see now (as i mentioned, were are not the original designers of this site) - the plup module is the one creating the widget - so likely that module which has the issue.

thanks for sticking with this.. :)

liquidcms’s picture

and sure enough, upgrading to the latest -dev of Plup fixes the issue.

slashrsm’s picture

Great :)

Status: Fixed » Closed (fixed)

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

  • Commit 710e33f on 7.x-1.x, 7.x-2.x, 8.x-1.x by slashrsm:
    Issue #1414486 by nbucknor, annblack: Allow for Multiple Plupload...
  • Commit 83e675a on 7.x-1.x, 7.x-2.x, 8.x-1.x by slashrsm:
    Issue #1414486 by nbucknor,slashrsm: Improvements of errorhandling for...