Skip Ribbon Commands Skip to main content

SharePoint Happenings

Help (new window)
Sign In
Navigate Up
Get Microsoft Silverlight
Install Silverlight plugin for a richer experience...
Blog Home |  Freeware |  Speaking |  About me

All my OK Buttons in SharePoint are throwing javascript errors!



Bookmark and Share

Top Tech Links










Top SharePoint Administrator Links









Top SharePoint Developer Links













NOTE: This blog has been moved to http://blog.philwicklund.com. If you'd like assistance, leave a comment on the copied post in the new location (hint, use search on the right to find the post).


All of a sudden all my ok buttons in all my SharePoint sites started throwing javascript errors whenever they were clicked. For example, if I was in a SharePoint list and I wanted to add a new list item, it would break when I clicked ok.

 

I dug into the issue deeper by enabling javascript debugging in my IE browser, and noticed it was throwing an "Object Expected" javascript error:

 

 

Well, it didn't help any to debug it, but after wasting a few hours I figured out what was causing the problem. It turns out that I had added a script tag into the head of my master page. Nothing crazy about that, or so you'd think, but for some reason it needed to be well formed:

 

Breaks all the OK Buttons: <script type="text/javascript" src="/_layouts/ custom/custom.js" />

 

The Fix: <script type="text/javascript" src="/_layouts/custom/custom.js"></script>

 

I was blown away when I realized this was the problem. Maybe there were some javascript 101 topics I failed to learn in college or something… (either that or SharePoint 101)

 

Phil