If you override theme_button() with something like the following snippet, upload buttons will cease working.

function mytheme_button($element) {
  // Make sure not to overwrite classes.
  if (isset($element['#attributes']['class'])) {
    $element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
  }
  else {
    $element['#attributes']['class'] = 'form-'. $element['#button_type'];
  }
  return '<div class="submit-button"><input type="submit" '. (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ')
     .'id="'. $element['#id'] .'" value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." /></div>\n";
}

Looked in filefield.js to find something similar to this on lines 80 and 84:

$enabledFields = $(this).parent().parent().find('input.form-file');

I'm guessing we can change that to use the parents() jQuery function and it'll fix it. Don't have the time right now to roll a patch but will if no one else gets to it first.

Files: 
CommentFileSizeAuthor
#1 filefield_button_js.patch797 bytesquicksketch

Comments

Status:Active» Needs review
StatusFileSize
new797 bytes

Oddly I put a conditional in the JS file specifically to prevent this exact problem, but I didn't actually change the logic. :P

This is what it's meant to do. Try it out and let me know if it solves the problem for you.

Status:Needs review» Reviewed & tested by the community

It's all good. Thanks for the quick patch! How about the other line that uses parent().parent()?

Unfortunately the other parent().parent() is much more difficult to remove, since when CCK wraps the div around a group of fields, it doesn't put a class on it at all. It does have an ID, so it's possible we could do something like .parents('div[id*=-field-group-]'), or somehow try to build out the ID based on the file field itself.

Status:Reviewed & tested by the community» Fixed

Committed.

Status:Fixed» Closed (fixed)

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