While editing a piece of content for a CCK filefield, when I click the file browser button in IE 7 & 8 I am getting a Javascript error:

The error is:

Error
---------------------------
A Runtime Error has occurred.
Do you wish to Debug?

Line: 50
Error: 'Drupal.settings.fileFieldSources' is null or not an object

When I debug, it goes to this line of code in the file: 'filefield_sources.js'

var defaultText = Drupal.settings.fileFieldSources[sourceType] ? Drupal.settings.fileFieldSources[sourceType].hintText : '';

(see screen capture attached)

Comments

quicksketch’s picture

Thanks for the report. Is this actually in the very latest CVS dev version, or are you using the 1.1 stable release? We recently added a new source (existing file attachments) that may be causing the problem. Does the problem not occur at all in other browsers?

quicksketch’s picture

Category: support » feature
Status: Active » Fixed
StatusFileSize
new887 bytes

Ah, I think this is purely because you were using just the IMCE source and no sources that actually defined a Drupal.settings.fileFieldSources[sourceType] variable. Since there were no types at all that declared Drupal.settings.fileFieldSources, a JavaScript error results.

This patch makes sure that Drupal.settings.fileFieldSources exists before trying to check an individual source. I've committed to CVS.

danny englander’s picture

Version: 6.x-1.x-dev » 6.x-1.1
Category: feature » support
Status: Fixed » Active

I just realized I am using 1.1 stable from Jun-17, 2010. I have changed the version above.

If I view the console in Firebug / Firefox 3.6 for Mac, I see a very similar error. Neither ultimately prevents a file from being picked but the IE error could be an issue for my client as they are Windows based. thanks.

danny englander’s picture

oops, just saw you uploaded a patch the same time I posted. sorry.

The patch works, error is now gone. Thank you.

danny englander’s picture

Status: Active » Fixed
quicksketch’s picture

The 1.2 version should be coming out tomorrow FYI. Though if you want to "fix" the problem in the mean time, you just need to enable one other source type (such as autocomplete or remote URL), which will define the variable for you.

Status: Fixed » Closed (fixed)

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