Hello,

The module does not work when a language of the site other than English.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iorgos’s picture

+1

csfsousa’s picture

Hi,
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.

grahor_targ’s picture

This 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.

henryhu’s picture

#3 works. Thank you grahor_targ.

karopka’s picture

#3 works.

kurapov’s picture

ID selector is a cleaner solution but the way to get a translated value in JS is to use Drupal.t('Upload').

kurapov’s picture

Upon 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:

'submit_input' => 'input.form-submit[value=Upload]',

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.

igorik’s picture

@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.

grahor_targ’s picture

#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.

kurapov’s picture

@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 and 1.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:

    array(
      'context' => '.form-managed-file', // was 'div.form-managed-file'
      'file_input' => '.form-file', // was 'input.form-file'
      'file_event' => 'change',
      'submit_input' => '.form-submit[name$="upload_button"]', // was 'input.form-submit[value=Upload]'
      'submit_event' => 'mousedown',
      'error' => '.error', // was 'div.error'
      'error_remove' => '',
    ),

Works fine so far - also with AJAX forms, even multiple copies on the same page.

jomarocas’s picture

ok i add patch for this error , please update this issue

jacob.embree’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Active » Needs review
RgnYLDZ’s picture

The 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.

VasyOK’s picture

Hi, RgnYLDZ!
Use green version 7.x-1.0 for patchching.