The Content editor web part and Javascript

By peter.stilgoe









If you didnt know the content editor web part (CEWP) is a great way for adding code ie. JavaScript to your Sharepoint pages without having to edit / change the actual code. You need to add the CEWP to the bottom of your Sharepoint page & add the piece of script. Hey presto, desired effect without editing the actual code, a nice clean & easy way to make mods etc.

A couple of tips if you break your page with some bad code:

If you break your Web page:

When playing with the CEWP, you run the risk of adding bad code that will break your page. SharePoint will then throw out an error message, without offering any way to undo your changes.

If this happens to you, here is a useful trick: append the “?contents=1” querystring to your URL. It will give you access to the maintenance page, where you’ll be able to get rid of the faulty Web part.

For example, if you inadvertently break this page:

http://ThisServer.com/sites/ThisSite/ThisLibrary/allitems.aspx

Enter:

http://ThisServer.com/sites/ThisSite/ThisLibrary/allitems.aspx?contents=1

A trick to edit Web Part pages:

On some pages, the edit option is not available or is grayed out. This is for example the case for the edit form of a list.

The workaround here is to append the “?ToolPaneView=2” querystring to your URL, which will switch your page to edit mode. Note that it seems to be unsupported by Microsoft, though I haven’t read an official confirmation.

For example, if you want to edit:

http://ThisServer.com/sites/ThisSite/Lists/ThisList/editform.aspx

Enter:

http://ThisServer.com/sites/ThisSite/Lists/ThisList/editform.aspx?ToolPaneView=2

Thanks to http://pathtosharepoint.wordpress.com for the above 2 tips

Share

,

About... peter.stilgoe

peter.stilgoeThis author published 482 posts in this site.
Sharepoint, InfoPath, K2, Nintex, Business Process Mapping, Business Intelligence, Automation, ECM, Document Management, Document Imaging, Internet Marketing & Online Business Consultant Email / MSN: pstilgoe@hotmail.com LinkedIn: Pete Stilgoe - Sharepoint Consultant









Share

FacebookTwitterEmailWindows LiveTechnoratiDeliciousDiggStumbleponMyspaceLikedin

No Comments

(Required)
(Required, will not be published)