I don't know what, but something about my theme means that whenever upload.js is called on a page (ie, the "File Attachments" fieldset on a Node Edit form) it prevents collapse.js from running (the links are not being wrapped around the legends on collapsible fieldsets).

I've posted a couple of bug reports but they've been monumentally ignored ... does anyone else have any suggestions?

Comments

eroglik’s picture

Somehow I figured out, that the custom lines was generating the same problem for me were in the template.php. Some months ago I looked for a solution here for adding image type buttons to forms, ie. my search form. I pasted a function from drupal.org to the template.php.

Five minutes ago I figured out that the only problem with this issue could be with that function. I commented that out, and voila: the collapse.js and the upload.js works together as before.
Uhh. Can this solve your problem?

kingandy’s picture

Holy actual crap, that's done it.

I have no clue why the code in question (copied, IIRC, from here) would affect anything beyond a button with ['#button_type'] set to 'image' - as far as I can tell all it does is change

 return '<input type="submit" '. (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ')  .'id="'. $element['#id'].'" value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";

to

  $return_string = '<input ';
  if ($element['#button_type'] == 'image') {
    $return_string .= 'type="image" ';
  }
  else {
    $return_string .= 'type="submit" ';
  }
  $return_string .= (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ') .'value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";
  return $return_string;

... Ahhhh, wait wait wait, it's missing an id attribute. I guess I can see how that might impact some ID-reliant javascript or other...

Changing the last $return_string declaration to this: $return_string .= (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ') .'id="'. $element['#id'].'" value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n"; ... seems to have fixed the problem.

Thank you so much for tracking this down for me! I would never have thought to check there.

Right, now to update all my bug reports :D

--Andy
Developing Drupal websites for Livelink New Media

++Andy