If you try to upload two files before submitting the form, it doesn't work. Upon clicking upload for the second file, the list of attached files disappears, the fieldset resets (at least visually) to its state when you first create a page, and the JS error "button has no properties" is thrown (drupal.js, line 31).

To recreate:

  1. Turn on multiple values
  2. Create content (in this case, I'm using filefield with 'book')
  3. Browse and choose file, click Upload (file shows up as expected)
  4. Browse and choose second file, click Upload (kaboom)

Happens on both Firefox 2.0.0.11 and IE 7 on WinXP (if it matters).

Comments

jpetso’s picture

Status: Active » Postponed (maintainer needs more info)

I have seen that error when developing the JavaScript delete button, but I don't exactly remember the context. If I remember correctly, my instance of that error had nothing to do with filefield itself - but of course, that may be different here. (Although there is only one button in the whole filefield widget.)

Unfortunately, the error doesn't show up on my system, which means I can't debug it. Please post a list of the modules that you're using and the fields on that content type, and make dead sure that the Devel module is disabled. You could also try to disable some of your modules and see if the error is still there afterwards - that way, you can maybe find out which module or element is the offender (which largely increases the probability of this issue being solved).

Sorry, but I can't help much at the moment - plus, I hate debugging JavaScript. Good luck, though.

chanel’s picture

I tracked down the problem, but I don't understand why it wouldn't affect everyone. The problem is coming about because line 10 in upload.js is chopping off part of the id names: field-upload-file-attach-button becomes -attach-button, field-upload-file-attach-hide becomes -attach-hide. Unless we have different versions of upload.js, I don't why you wouldn't see the same thing. (I'm running 5.6 but it looks like upload.js hasn't been changed in over a year).

For future filefield users that run into the problem, the patch to upload.js that will fix the problem can be found at http://drupal.org/node/144032 in comment #1.

chanel’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
jpetso’s picture

The patch in that issue is obviously wrong and will likely break other stuff. Could you instead follow oadaeh's request and test out the patch here, then report back to the issue that you referenced?

chanel’s picture

I spoke (or typed) too soon anyway. While the patch I mentioned makes it look like it's working, it's not really -- a JS error still gets thrown and the images aren't actually uploaded. I'll check the other patch and report back on that thread.