Hi,

I created an imagefield field and set "Maximum number of images" to 3. There is no problem attaching the first two images, but after attaching the third file firebug reports an error:

button has no properties
redirectFormButton("http://mysite.com/imagefield/js", undefined, Object button=#field-testimagefieldjs-attach-button)drupal.js (line 31)
jsUpload("http://mysite.com/imagefield/js", "field-testimagefieldjs-attach-button", "field-testimagefieldjs-attach-wrapper", "field-testimagefieldjs-attach-hide")upload.js (line 27)
uploadAutoAttach()upload.js (line 14)
e([input#edit-field-testimagefieldjs-attach-url.upload http://mysite.com ..., input#edit-field-testimagefieldjs-attach-url.upload http://mysite.com ..., input#edit-field-testimagefieldjs-attach-url.upload http://mysite.com ...], function(), undefined)jquery.js (line 2)
e(function(), undefined)jquery.js (line 2)
uploadAutoAttach()upload.js (line 7)
oncomplete("<div><fieldset><div class="imagefield-edit-image-row clear-block"><div class="imagefield-edit-previe...")upload.js (line 92)
iframeHandler()drupal.js (line 74)
onload(load )test-imagefield-j... (line 1)
[Break on this error] button.onmouseover = button.onfocus = function() {

Perhaps the problem is related to the fact that the "upload" (attach) button is not displayed after the third image is attached, and perhaps some code is looking for that button. Dunno. Just a guess.

I am running cck version 5.x-1.6-1. The upload module is not enabled. Download method is private (I think. not sure how to check). There's no problem uploading files.

Thank you!

CommentFileSizeAuthor
#5 drupal_button.patch298 bytesrobphillips
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Tamar Badichi-Levy’s picture

I can confirm that I'm also experiencing the same issue. The issue exists in both firefox and IE (my version is IE7). The image is uploaded and seen but I get the same error.

dopry’s picture

Version: 5.x-2.0-rc6 » 5.x-2.x-dev

annotation: I think this may be cause by the button not being added to the form when max_images is reached... possible solutions: display: none instead of not displaying form elements. modify js to check if the button exists before trying to fark with it.

a_c_m’s picture

after disabling the JS on imagefield, i found another CCK widget (link) was also passing a undefined button var. As a quick hack i've added the line

if (button === undefined) return true;

to the start of the Drupal.redirectFormButton function in the drupal.js file (aprox line 30) which has for now fixed the problem. I will investigate further if time allows, also, i am using JQuery update 2, incase this is a contributing factor.

a_c_m

quicksketch’s picture

Title: firebug error "button has no properties" when max # files reached » Firebug error "button is undefined" when max # files reached

Just confirming this is still a problem in the 2.6 version of ImageField in Drupal 5. Possibly due to changes in FireBug, this error has now changed to "button is undefined" instead of "button has no properties". It's difficult to actually change the JavaScript, since the upload.js file is provided by core and ImageField doesn't actually have control over it. I think dispay: none might be our best bet.

I'm not too concerned with the Drupal 5 version these days. If someone can provide a patch I'd be glad to accept it.

robphillips’s picture

FileSize
298 bytes

For those who are still having the issue and aren't sure where to put a_c_m hack, I've attached a simple patch.

jenlampton’s picture

I had "button is undefined pop up in FireBug when I set a fieldset form element with '#tree' = true. I *do* have an imagefield element on this form, but not within the problematic fieldset where the tree flag caused the js error. very strange.

This fixed the problem for me, thank you!

quicksketch’s picture

Status: Active » Closed (won't fix)

Closing out Drupal 5 issues.