Formatting Text / Questions in Sharepoint Surveys
By peter.stilgoe
If you have ever tried to format text and / or insert line breaks into your questions in sharepoint surveys, you’ll know its not an easy task. However by adding some simple javascript you can format the text in your questions as you want.
Basically at the bottom of your survey page add a Content Editor Webpart & insert the follow script:
You will see the script is mapping your HTML standard HTML command to keywords to trigger your formatting.
So say you wanted your question to appear in italics, you would edit your question as normal but insert the italic keyword triggers ie.
How old are you?
To appear in italics you would write the question as:
startitalic How old are you? enditalic
Now your question will appear in italics and so on……..
If you cant edit your survey page to add you CEWP see the previous post on how to edit this page.
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



September 22nd, 2009

![Recommend [pstilgoe]](http://s3.amazonaws.com/arkayne-media/img/badge/logo-recommend-badge-medium.png)