Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
The module does not work when a language of the site other than English.
Comment | File | Size | Author |
---|---|---|---|
#11 | autoupload-other_languages-2487886-#11-7.x.patch | 851 bytes | jomarocas |
Comments
Comment #1
iorgos CreditAttribution: iorgos commented+1
Comment #2
csfsousa CreditAttribution: csfsousa commentedHi,
I found the same problem and I solved it by putting the module into /sites/all/modules folder as if it was my own module and it works perfectly.
Comment #3
grahor_targ CreditAttribution: grahor_targ as a volunteer commentedThis is because the module defines the button by its value: [value=Upload]
Other languages have other values for the button. Unfortunately, I don't know how to provide a proper patch, so I'll just post the solution:
If you'll edit autoupload.js file and replace two occurrences of [value=Upload]
$('.form-item input.form-submit[value=Upload]', context).hide();
and
$('input.form-submit[value=Upload]', $parent).mousedown();
with [id$='upload-button'] (don't forget to replace single quotes), resulting lines should be:
$(".form-item input.form-submit[id$='upload-button']", context).hide();
$("input.form-submit[id$='upload-button']", $parent).mousedown();
then it should work. It works in my sites with Russian translation.
Comment #4
henryhu CreditAttribution: henryhu commented#3 works. Thank you grahor_targ.
Comment #5
karopka CreditAttribution: karopka commented#3 works.
Comment #6
kurapov CreditAttribution: kurapov as a volunteer commentedID selector is a cleaner solution but the way to get a translated value in JS is to use
Drupal.t('Upload')
.Comment #7
kurapov CreditAttribution: kurapov as a volunteer commentedUpon further testing, the proposed solution breaks in case of multiple forms on the same page and/or after validation errors as the id's of the element are being appended with "--2", "--3" etc. index which breaks the regex.
Thus it should either be
[id*='upload-button']
(i.e. regex matching not "ends with" but "contains"),[name$="upload_button"]
(so far in my testing it's not being changed NB: underscore, not hyphen) or just simply[type="submit"]
.As for
1.0-dev
version, it retains[value=Upload]
selector in_autoupload_get_predefined()
function:It may be fixed either in code or overridden by a user as a "Custom File Types"-setting.
Oh, and one more thing:
input.form-submit
selector doesn't take into account the<button>
tag, see #2388077: Not all themes use inputs.Comment #8
igorik CreditAttribution: igorik as a volunteer commented@kurapov, not sure if I understand you wrote.
I tried the patch from #2388077: Not all themes use inputs, but it didn't work for me.
But comment #3 is working like charm.
Comment #9
grahor_targ CreditAttribution: grahor_targ as a volunteer commented#7 is correct about possible problems with #3 in case of multiple forms on the same page and possibly in case of validation errors.
As far as I've understood #7, one of the proposed solutions should look like modified #3:
$(".form-item input.form-submit[name$='upload_button']", context).hide();
$("input.form-submit[name$='upload_button']", $parent).mousedown();
I have not tested it myself, I've just wrote what #7 says in a more obvious and simple way.
patch from #2388077 does not solve this particular language problem; it's a warning from kupalov about yet another way some themes may brake the module. :) If your theme doesn't use "input", but uses html5 button, you need you merge solutions from #2388077 and this one.
Comment #10
kurapov CreditAttribution: kurapov as a volunteer commented@grahor_targ Thanks for explaining my idea better than I did. Unfortunately, this great module is left unmaintained and users keep reiterating the same problems over and over, providing partial solutions for their own issues which need to be merged. This is further complicated by the major differences between
1.0
and1.x-dev
versions.Here's some code that works for me - perhaps it will be more useful than my general musings above. I took the
dev
version and created a "custom file type" with the following (less specific) jQuery selectors:Works fine so far - also with AJAX forms, even multiple copies on the same page.
Comment #11
jomarocas CreditAttribution: jomarocas as a volunteer commentedok i add patch for this error , please update this issue
Comment #12
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedComment #13
RgnYLDZ CreditAttribution: RgnYLDZ commentedThe lines
$('.form-item input.form-submit[value=Upload]', context).hide();
and
$('input.form-submit[value=Upload]', $parent).mousedown();
doesn't seem to exist in the JS file autoupload.js. Is the patch still relevant? I have this issue on my multilingual website.
Comment #14
VasyOK CreditAttribution: VasyOK commentedHi, RgnYLDZ!
Use green version 7.x-1.0 for patchching.