Ajax bug on upload/delete Ubercart images

aks - March 17, 2009 - 01:18
Project:Ubercart
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

1. cck 6.x-2.1
2. imagefield 6.x-3.0-beta1
3. tmp read/write
4. public downloads
5. imagefield 6.x-3.0-alpha4 configured by ubercart, then updated to 6.x-3.0-beta1
6. imagefield image upload
7. IE6: image upload works only with javascript enabled (via ajax). image deletion works only with javascript disabled (via full request)
8. check this on IE6 on common config.

#1

quicksketch - March 17, 2009 - 01:20

Thanks for the report. The image upload only working when JavaScript is enabled has been fixed in #403216: Upload fails when JS is disabled. I'll look into deleting in IE6. I'm guessing that you're implying that all other browsers work fine when deleting images?

#2

quicksketch - March 17, 2009 - 01:27

Using the latest CVS version (with the #403216: Upload fails when JS is disabled patch applied), I'm not able to confirm this problem. IE6 works uploading/removing/saving images with or without JavaScript.

#3

aks - March 17, 2009 - 01:43

Firefox works fine! I'll try latest CSV version to fix #403216: Upload fails when JS is disabled

#4

quicksketch - March 17, 2009 - 01:48

Note you'll need the latest version of FileField, which is where the no-JS bug actually originated.

#5

aks - March 17, 2009 - 02:13

I've applied the patch to filefield, it had effect that IE is able to upload/delete without JS, but still can't delete with JS. It seems that ajax call works (imagefield item disappeared in list after clicking 'delete'), and real deletion does not.

#6

quicksketch - March 17, 2009 - 04:45

It seems that ajax call works (imagefield item disappeared in list after clicking 'delete'), and real deletion does not.

What do you mean by "real deletion"? The file isn't actually removed from the node or disk until the node is saved.

#7

rsm08 - March 24, 2009 - 00:01

I seem to have a similar problem, so I'll join this thread.

When adding or editing a node with a CCK imagefield (with multiple images allowed), :

In IE7, upload works fine, but when clicking the "Add another item" button to add fields for uploading another image, the whole imagefield part of the form just disappears.

The page doesn't reload, and there's no problem in Firefox, so it must be a javascript-issue. (Which leaves me clueless since I have no js debugger for IE).

I'm using:
Drupal 6.9
CCK 6.x-2.1
ImageField 6.x-3.0-alpha4

Hope you can help, thanks!

#8

quicksketch - March 24, 2009 - 00:12

rsm08, you'll need to upgrade to at least beta3 before we'll be able to help you. The problem you're reporting very well may have already been fixed. Upgrading to CCK 2.2 is also highly recommended, since it corrects an issue with the "more" button breaking uploads.

#9

rsm08 - March 24, 2009 - 00:23

quickstetch, thanks, I was trying to avoid the beta versions, but I'll try your advice and report my findings here.

#10

drewish - March 24, 2009 - 00:31

i've got to chuckle at being willing to use alpha software but being scared off by beta

#11

rsm08 - March 24, 2009 - 03:11

Oh, I didn't notice it was an alpha version. ;) What I meant was that I was trying to avoid dev versions if there was a safe but earlier version available!

Well, I updated, and though the upload interface is now nicer and simpler than before, the javascript problem remains the same. The instance I click "Add another item", the whole imagefield area disappears without a page reload.

Note that the problem is still only in IE7. FF works fine.

My versions are now:
CCK 6.x-2.2
ImageField 6.x-3.0-beta3
ImageAPI 6.x-1.5
ImageCache 6.x-2.0-beta8
Ubercart 6.x-2.0-beta5

Hope you can help!

#12

quicksketch - March 24, 2009 - 21:43

Are you having trouble with Ubercart ImageFields, or is it all ImageField's in general? I know Ubercart had to do some changes when the beta versions of ImageField came out, see #404352: Image (field_image_cache) is an inactive image field.

I ask because I can't reproduce this problem at all. On my sandbox uploading/removing/add another item all work just fine on IE7 and even on IE6. Are you logged in as the same user in both FF and IE?

#13

rsm08 - March 24, 2009 - 22:58

Actually it's only Ubercart imagefields. I tried this in another content type, and there was no problem.

So it's only in Ubercart's content types that this problem occurs. I guess I'll have to take this issue to Ubercart's site then.

Thanks for helping me out!

#14

quicksketch - March 24, 2009 - 23:07
Title:Ajax bug on upload/delete image» Ajax bug on upload/delete Ubercart images
Category:bug report» support request
Priority:critical» normal
Status:active» closed

Great, thanks for the followup. It seems like the Ubercart folks have fixed this just recently in that issue I posted above.

#15

rsm08 - March 24, 2009 - 23:18

But this issue you posted, I can't see how this has anything to do with my problem!?

As I understand it, the mentioned issue has something to do with problems caused by updating imagefield, and I had this problem before I updated either module!

Am I missing something here?!

#16

chumm - April 7, 2009 - 11:54

I am experiencing the same issue with IE7 and IE8.

In all browsers (IE7, IE8, Firefox), clicking the 'REMOVE' button associated with the image does appear to remove the image from the edit page. Then as usual, when clicking 'SAVE' at the bottom, the product page shows up once again. However, if using IE, the image is not deleted and still displays.

This is NOT the case with Firefox. Firefox works as it should.

Can anyone offer some help with this, as I need it to work in IE. I tried searching the forms for can't delete images ie and didn't see anything relevant to my issue.

For reference, I'm running the following which Drupal reports are all up to date:
Drupal 6, Ubercart 2
Content 6.x-2.2
FileField 6.x-3.0-rc1
ImageField 6.x-3.0-rc1
ImageAPI 6.x-1.5
ImageCache 6.x-2.0-beta8

#17

chumm - April 7, 2009 - 12:04
Status:closed» active

I meant to re-open this in my last post.

#18

quicksketch - April 7, 2009 - 15:40

I'm at a loss for what's wrong here. Any other Ubercart users please post if you're having trouble or what can be done to solve the problem. I'm leaving this up to the Ubercart team to solve this problem, since I'm not going to install an entire e-commerce site just to test out FileField. It works fine on normal node posts in all browsers.

#19

chumm - April 7, 2009 - 15:46

Is there anything that I could do to try and debug? I'm surely not a programmer but would be willing to help out to test/debug this if it can help lead to a fix.

#20

chumm - April 8, 2009 - 16:21

I tried a completely fresh Drupal and Ubercart install. This problem continues to exist! My experiences below:

Installed Drupal 6.9 through my webhost. Then I immediately updated it to v6.10.

Then I uploaded all the Ubercart files (v6.x-2.0-beta5) and installed the latest Ubercart modules. I went to enable image support and got the following error messages:

    * user warning: Duplicate entry 'field_image_cache' for key 1 query: INSERT INTO content_node_field (field_name, type, global_settings, required, multiple, db_storage, module, db_columns, active, locked) VALUES ('field_image_cache', 'image', 'a:3:{s:10:\"list_field\";s:0:\"\";s:12:\"list_default\";s:1:\"0\";s:17:\"description_field\";s:0:\"\";}', 0, 1, 0, 'filefield', 'a:3:{s:3:\"fid\";a:2:{s:4:\"type\";s:3:\"int\";s:8:\"not null\";b:0;}s:4:\"list\";a:3:{s:4:\"type\";s:3:\"int\";s:4:\"size\";s:4:\"tiny\";s:8:\"not null\";b:0;}s:4:\"data\";a:2:{s:4:\"type\";s:4:\"text\";s:9:\"serialize\";b:1;}}', 0, 0) in /home/samplesite/public_html/includes/common.inc on line 3422.
    * user warning: Duplicate entry 'field_image_cache-product' for key 1 query: INSERT INTO content_node_field_instance (field_name, type_name, weight, label, widget_type, widget_settings, display_settings, description, widget_module, widget_active) VALUES ('field_image_cache', 'product', -2, 'Image', 'imagefield_widget', 'a:12:{s:15:\"file_extensions\";s:20:\"gif jpg jpeg png bmp\";s:9:\"file_path\";N;s:21:\"max_filesize_per_file\";N;s:21:\"max_filesize_per_node\";N;s:14:\"max_resolution\";N;s:14:\"min_resolution\";N;s:3:\"alt\";N;s:10:\"custom_alt\";s:1:\"1\";s:5:\"title\";N;s:12:\"custom_title\";s:1:\"1\";s:13:\"default_image\";N;s:17:\"use_default_image\";N;}', 'a:4:{s:5:\"label\";a:1:{s:6:\"format\";s:6:\"hidden\";}s:6:\"teaser\";a:1:{s:6:\"format\";s:6:\"hidden\";}s:4:\"full\";a:1:{s:6:\"format\";s:6:\"hidden\";}i:4;a:1:{s:6:\"format\";s:6:\"hidden\";}}', '', 'imagefield', 1) in /home/samplesite/public_html/includes/common.inc on line 3422.

Then I uploaded all the latest Ubercart dev version files (6.x-2.x-dev) and ran the update.php script.

Then I went to enable image support once again and this time got the following errors:

    * user warning: Duplicate entry 'field_image_cache' for key 1 query: INSERT INTO content_node_field (field_name, type, global_settings, required, multiple, db_storage, module, db_columns, active, locked) VALUES ('field_image_cache', 'filefield', 'a:3:{s:10:\"list_field\";s:1:\"0\";s:12:\"list_default\";i:1;s:17:\"description_field\";s:1:\"0\";}', 0, 1, 0, 'filefield', 'a:3:{s:3:\"fid\";a:2:{s:4:\"type\";s:3:\"int\";s:8:\"not null\";b:0;}s:4:\"list\";a:3:{s:4:\"type\";s:3:\"int\";s:4:\"size\";s:4:\"tiny\";s:8:\"not null\";b:0;}s:4:\"data\";a:2:{s:4:\"type\";s:4:\"text\";s:9:\"serialize\";b:1;}}', 1, 0) in /home/samplesite/public_html/includes/common.inc on line 3422.
    * user warning: Duplicate entry 'field_image_cache-product' for key 1 query: INSERT INTO content_node_field_instance (field_name, type_name, weight, label, widget_type, widget_settings, display_settings, description, widget_module, widget_active) VALUES ('field_image_cache', 'product', -2, 'Image', 'imagefield_widget', 'a:12:{s:15:\"file_extensions\";s:11:\"gif jpg png\";s:9:\"file_path\";N;s:21:\"max_filesize_per_file\";N;s:21:\"max_filesize_per_node\";N;s:14:\"max_resolution\";N;s:14:\"min_resolution\";N;s:3:\"alt\";N;s:10:\"custom_alt\";i:1;s:5:\"title\";N;s:12:\"custom_title\";i:1;s:13:\"default_image\";N;s:17:\"use_default_image\";N;}', 'a:4:{s:5:\"label\";a:1:{s:6:\"format\";s:6:\"hidden\";}s:6:\"teaser\";a:1:{s:6:\"format\";s:6:\"hidden\";}s:4:\"full\";a:1:{s:6:\"format\";s:6:\"hidden\";}i:4;a:1:{s:6:\"format\";s:6:\"hidden\";}}', '', 'imagefield', 1) in /home/samplesite/public_html/includes/common.inc on line 3422.

Interestingly enough, it does say: Product image support has been automatically configured by Ubercart.

HOWEVER.... I am experiencing the exact same image problems as I am on my primary site. Images can be removed from products only when using Firefox. Doesn't work in IE. Also, my product images are missing the 'replace' image upload option.

Does anybody know what is going on here? This is quite frustrating.

#21

quicksketch - April 8, 2009 - 16:51
Project:ImageField» Ubercart
Version:6.x-3.0-beta1» 6.x-2.x-dev

#22

chumm - April 8, 2009 - 17:33
Version:6.x-2.x-dev» 6.x-2.0-beta5

Update: Reverting to FileField 6.x-3.0-alpha7 and ImageField 6.x-3.0-alpha4 fixes the issue, and I can once again actually delete images that are associated with products.

Perhaps the developers of these modules can figure out what happened somewhere between these versions and the current ones.

#23

Island Usurper - April 8, 2009 - 21:51
Version:6.x-2.0-beta5» 6.x-2.x-dev
Assigned to:aks» Anonymous

Oh blargh.

I think it's got something to do with the product node form. There's nothing different (any more) about the image fields that Ubercart puts on products. I can add the existing field to other content types, and it works fine in IE (I'm using IE8). But, adding a new image to pages, and then adding that field to a product class causes the Remove button and "Add another item" to not work.

If someone can test with another node-type module (Event, maybe?), I'd like to know if that's the problem. I don't know what is unique about uc_product_form() that throws AHAH in IE for a loop.

#24

Island Usurper - April 10, 2009 - 13:38
Category:support request» bug report

#25

CandC540 - May 9, 2009 - 19:50

I have the same problem with attaching multiple files breaking FileField

#26

epop - June 1, 2009 - 07:57

joining this thread, i too cant delete images from products in IE. I have all the latest versions. This is a major issue. Other content types work fine its just Ubercart Products. So the problem must be with Ubercart and its interactions wit IE.

#27

Island Usurper - July 10, 2009 - 14:47
Status:active» needs review

This is an amazing bug. I'm really fortunate that the IE 8 JScript debugger works even better than Firebug, or I might never have found it.

Some background: ahah.js uses a function called ajaxSubmit() from jquery.form.js to send the HTTP request. ajaxSubmit() takes the data it is given, and combines it with the form values on the page to send as POST data. And in the vast majority of cases, this works just fine.

However, to get the form values, ajaxSubmit() calls formToArray(). This function runs a for() loop on all of the elements of the form, and uses the els.length as the upper bound of the loop. Somehow, and only in IE, els.length isn't the numeric size of the array of elements, but the actual "length" form element. You can't compare objects as numbers, so the function returns an empty array, and the form values aren't included in the POST data.

When Filefield can't find $_POST['form_build_id'], it thinks the upload failed because the file was too big, and returns an error message saying so.

So, the most obvious solution is to change the name attribute of the length field. Because I like symmetry, I also changed the width and height fields. This should only affect the node-edit form. $node->length and friends should remain the same since uc_product_load() wasn't changed.

#28

Island Usurper - July 10, 2009 - 14:48

And with a patch, this time.

AttachmentSize
dim_length.patch 4.53 KB

#29

fenstrat - July 11, 2009 - 02:49
Status:needs review» reviewed & tested by the community

Works perfectly.

Very, very strange bug.

Lyle your spot on - the culprit is the for loop which uses els.length as the upper bounds. The reason looks to be IE's reserved words. In particular length.

Interesting timing, I'd finally got some time to track this down and was just submitting a patch to change length to dimension_length just as you did (minus your consistency touch with width and height). Last minute search found this - you beat me too it, so still can't clame my first patch!

btw this also effects Opera.

Making these 2 as duplicates:
#448314: Unable to remove product images in IE or Opera
#435312: Getting error message when deleting images

#30

Island Usurper - July 13, 2009 - 13:42
Status:reviewed & tested by the community» fixed

Thanks for testing. Committed.

#31

System Message - July 27, 2009 - 13:50
Status:fixed» closed

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

#32

asianguy - October 20, 2009 - 12:04

when UPS product description Package type is set to Customer Supplied Package, Product cant be saved because "Dimensions are required for custom packaging", it always ask for dimension even if dimension has values

 
 

Drupal is a registered trademark of Dries Buytaert.