How to reproduce:
- Install file fieldsources module
- Create a new file field in a content type
- The auto-update won't work
This happend because FileField Sources overwrite the Drupal.file.triggerUploadButton with this:
// Override triggerUploadButton method from file.js.
Drupal.file.triggerUploadButton = function (event) {
$(event.target).closest('.form-managed-file').find('.form-submit.upload-button').trigger('mousedown');
}
And the upload-button class is only added UNTIL something is saved in the filefield sources module (in the Manage form Display page), so any new file field hasn't this class and therefore the auto-upload doesn't work.
Proposed solution:
My proposed solution is just delete the FileField Sources Drupal.file.triggerUploadButton method, drupal can handle all the file fields, those with filefields preferences and those without it.
Comments
Comment #2
gnugetPatch attached.
Comment #3
uno commentedI can confirm the Auto upload issue and that it was solved for the normal image field by the patch provided in #2.
The problem remains with Auto upload for image field using "Insert" module. The problem is there only when File Field Sources are installed.
Would you be kind to check that one as well?
Comment #4
FanisTsiros commented@uno
Patch in #2 works with Insert Module. May you have to clear caches. :)
Comment #5
mlncn commentedComment #6
uno commentedSorry, I forgot about this issue - You are right, patch works fine, no problems whatsoever,
Comment #7
shane birley commentedI am just adding this for issue awareness.
I will take a look at the patch here to see if it indeed a remedy for the problem I have experienced in the last few days.
Comment #8
gnugetIf this fixes your issue I will try to contact the maintainer of the module and ask if it is possible to give a review to my patch.
Let me know if it worked.
Thanks!
Comment #9
shane birley commentedI have applied the patch and it does seem to correct the problem. I will test it out a bit more but things seem to be working now that the override is gone.
Comment #10
szato commentedMy issue:
- filefiled_sources enabled on (node type) image field
- auto upload is broken for image field --> the image is uploaded, saved on node save, it's OK
- auto upload is broken for CKEditor image --> can't add an image in CKEditor, image plugin works only with auto upload
Patch #2 fixed my issue too.
Comment #11
shane birley commentedI have applied this patch to a couple of other sites as well and it seems to be working.
Comment #12
gnugetI already sent a few messages in the last two years to commit this without luck.
What would be the next steps? start the process to become the owner of the module? I don't have too much time to work on new features but for sure I can review/commit patches with fixes.
I will try to contact someone with commit access one last time before to do anything else.
I'm glad that all is working for you :)
David.
Comment #13
szato commentedNew issue pops up with patch #2:
- apply the patch #2
- add an image field with required alt to the content
- enable filefield sources for this image field (upload + something else)
- if you upload (browse and auto upload is triggered) an image, you will get the message: "Alternative text field is required."
So the original override of triggerUploadButton method is needed in some cases.
I created a patch to fix this issue too.
Comment #14
szato commentedComment #15
sashken2 commentedThanks! Patch #13 works good for me.
Comment #16
dave kopecek#13 Works for me as well.
Comment #17
idflood commentedPatch in #13 fixed the issue for us too, thanks gnuget & szato!
Comment #19
gnuget