I have a filefield/imagefield (core 7.9), with the filefield_sources (v 7.x-1.4) widget & IMCE (v 7.x-1.5) enabled. When I insert a file from IMCE, the filefield does not update in IE7-8-9.

This works fine in Firefox, filefield updates with filename and preview/icon of the inserted file.
IMCE works fine with Wysiwyg bridge in Tinymce in all versions of IE too, so this seems to be an filefield_sources issue.

I have looked at the code myself, but I have no idea what's going wrong.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ducktape’s picture

Status: Active » Needs review
FileSize
990 bytes

After some research, I found the source of the problem. IE doesn't support the "onchange" event.

Adding the same actions in an "onblur" event seems to fix this.
That requires a "visibile" form element though. Hidden fields and textfields with "display:none" or "visibility:hidden" didn't work either. I added a "position:absolute" to fix the layout.

A better solution is always appreciated.

tirdadc’s picture

I'm running into this very issue but specifically on IE8 only. I tried the patch and it results in a new error ("Object doesn't support this property or method") but if I ignore it, the filefield is filled out correctly. Still trying to resolve that for now.

tirdadc’s picture

Alright, this version uses try/catch to suppress the weird JS error and the field works fine in IE8.

quicksketch’s picture

Thanks @tirdadc and @ducktape for the patches! Seems that onchange really just isn't supported on hidden fields, so after changing the #type to a 'textfield', changing the event to onblur is unnecessary. I also encountered a problem with the hidden textfield that if you used the tab key to go through elements on the page, you would accidentally focus and then blur the textfield, causing it to attempt to attach nothing. No error would occur, but it would fire an AJAX event and reload the file element.

I made some minor changes that simplify the JS and appear to work in all browsers (Opera, Firefox, Chrome, IE7-9). I've committed this patch to both branches of the project in preparation for a new release shortly.

quicksketch’s picture

Status: Needs review » Fixed

Committed and pushed.

amfranco’s picture

Thanks! this patch works fine in IE8 but without the property '#disabled' => TRUE

quicksketch’s picture

That's odd, I tried it out in IE8 and it worked fine. Are you saying that the 1.5 release doesn't work in IE8? Which version of jQuery are you using on the site?

amfranco’s picture

I tried the release 1.6 and still not working with IE8, the action 'onblur' is also needed(check comments above), I am using JQuery 1.4.4.
This issue is for 'File browser' option using IMCE in an imagefield, the 'Upload' option works ok.

bmblack’s picture

I'm also using 1.6 with jquery 1.4.4 and the file browser is not working in IE8

bmblack’s picture

Hopefully this additional info helps:

When i choose an image through the "File browser" option (in IE8), it appears as though nothing is happening. The file browser window just closes. If i save, the image I selected is not displayed.

I noticed if I select an image from the file browser, then inspect the page before saving, the hidden text field IS populated with the relative URL to the image I selected.

bmblack’s picture

Status: Fixed » Active
memoorthy’s picture

+ Subscribing. I'm using IE8. After selecting the file in IMCE, insert does not do anything.

augustynen’s picture

I'm working with the latest version off IMCE and even after trying the different paches, nothing happens in IE8, IE9 works just fine.

But i'm working on a intranet.
Stuff like this should work on XP with IE8.

quicksketch’s picture

Version: 7.x-1.4 » 7.x-1.7
Status: Active » Fixed
FileSize
711 bytes

Okay I found the reason why it was working for me was a jQuery version issue. If you install jQuery update and use jQuery 1.5.x or 1.7.x, then the problem does not occur. However, supporting the stock D7 version of jQuery is more important than dealing with an extra hidden field that gets focus accidentally at times, so I essentially undid my changes and used the suggested approach by @amfranco.

Status: Fixed » Closed (fixed)

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

johnrosswvsu’s picture

Version: 7.x-1.7 » 6.x-1.10
Issue summary: View changes
Status: Closed (fixed) » Needs review

Hi,

The latest patch (which is already in the recent versions of the module) does not work in Mac OS browsers, as per supported by https://drupal.org/node/2004922.

Personally experienced similar issue also.

Thanks.

johnrosswvsu’s picture

Status: Needs review » Needs work
osopolar’s picture

Title: Insert file on IMCE fails in Internet Explorer (7-9) » Insert file on IMCE fails in some Browsers
Status: Needs work » Needs review
FileSize
1.05 KB

One thing is, that file_path is still rendered as hidden instead of text-field as fixed #4, the other thing is, that on blur is not triggered always - it seems to depend on the jQuery version and the Browser. On Firefox the d7 version is working well with onblur but the d6 not. Using onchange seems to work well – tested on MacOS (Safari, Firefox and Chrome) and Windows (IE8 (WinXP) an IE11 and Firefox (Win7)), jQuery version 1.3.2.

Not sure but maybe this is somehow related to jQuery blure() – at least it could be an explanation why blure works on d7 (using jQuery 1.4.4) but not d6 (with jQuery 1.3.2):

The blur event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the blur event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping blur to the focusout event in its event delegation methods, .live() and .delegate().

  • quicksketch committed 20f7a6e on 8.x-1.x
    Issue #1334378: Insert file on IMCE fails in Internet Explorer (7-9).
    
  • d8c92c3 committed on 8.x-1.x
    Issue #1334378 by ducktape, tirdadc, and quicksketch: Insert file on...
quicksketch’s picture

Status: Needs review » Closed (won't fix)

D6 is no longer supported, so closing this out.