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)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | filefield_sources_js_variable.patch | 887 bytes | quicksketch |
| 2010-08-10_13.08.24.png | 39.7 KB | danny englander |
Comments
Comment #1
quicksketchThanks 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?
Comment #2
quicksketchAh, 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 declaredDrupal.settings.fileFieldSources, a JavaScript error results.This patch makes sure that
Drupal.settings.fileFieldSourcesexists before trying to check an individual source. I've committed to CVS.Comment #3
danny englanderI 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.
Comment #4
danny englanderoops, just saw you uploaded a patch the same time I posted. sorry.
The patch works, error is now gone. Thank you.
Comment #5
danny englanderComment #6
quicksketchThe 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.