Content Editor Web Part JavaScript Error

15 May

After installing SharePoint (MOSS) SP1, I ran into a problem with many of my Content Editor Web Parts (CEWP) wherein when you press ‘edit’ instead of showing the nice toolbar, you get a javascript error.


"Object does not support this property or method"  on line 169.

I debugged the javascript using Visual Studio, and it was immediately apparent that a string cast was needed in line 168 of assetpicker.js.

You can find this javascript file here:

Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS1033assetpicker.js

The area of code in question looks like this:

The line in question is where the variable ‘nameValuePair’ is created, and assigned the value from propArray[i].split("=").  The members of propArray aren’t strings, and as such the split command isn’t available.

Change that one line to use a javascript string cast.  Which can be done by wrapping "String(…)" around the array.  (In red below)

That change is on line 168.  Try making it in the javascript, and clear your temporary internet files/browser cache, then revisit your SharePoint site.  The toolbar should show up now.

Leave a Reply

Your email address will not be published. Required fields are marked *