When core upload widget submit button being generated is not using <input>, the js code to hide the button is not working. It is possible to use <button>, <img> or even <a>.

CommentFileSizeAuthor
#2 file_resup-upload_button-2383659-2.patch1.11 KBckng

Comments

ckng’s picture

Issue summary: View changes
ckng’s picture

StatusFileSize
new1.11 KB

Attached patch solves the issue

- changed js to not target input only
- changed widget to load the file_resup.js

file_resup.min.js should be removed, IMHO, not very useful in d.o.

ckng’s picture

Status: Active » Needs review
anrikun’s picture

Status: Needs review » Closed (won't fix)

Core modules/file/file.js expects file upload and remove buttons to be input elements:

<?php
/**
 * Attach behaviors to the file upload and remove buttons.
 */
Drupal.behaviors.fileButtons = {
  attach: function (context) {
    $('input.form-submit', context).bind('mousedown', Drupal.file.disableFields);
    $('div.form-managed-file input.form-submit', context).bind('mousedown', Drupal.file.progressBar);
  },
  detach: function (context) {
    $('input.form-submit', context).unbind('mousedown', Drupal.file.disableFields);
    $('div.form-managed-file input.form-submit', context).unbind('mousedown', Drupal.file.progressBar);
  }
};
?>

So does file_resup.js.

ckng’s picture

Exactly why we look for better upload alternative. Fixing the core is as simple as add addition js to bind to the correct button. We could do the same for this case as well. However, it would be way better if it works out of the box.

Overall this is tiny change which would provide wider module/theme support, especially HTML5. So I don't understand why it is turned down.

anrikun’s picture

@ckng: another user requested your change in JS at #2397075: Add support for the Bootstrap theme so I guess I will commit it after all.

anrikun’s picture

Status: Closed (won't fix) » Closed (fixed)

This is now committed, thanks!