Had an interesting question… how do I add a Content Editor Web Part to a SharePoint survey. Turns out this is pretty easy, with one trick, one bug and one caveat.
- SharePoint 2007 will need a web part trick.
- SharePoint 2013 has a "bug" that requires you to edit the page in SharePoint Designer. The steps below include 2013 just in case they fix the bug! Be forewarned, adding a CEWP in Designer 2013 is not trivial as they left out the Design View. You have to hand edit your HTML for the web part!
- The caveat has to do with how multipage surveys are displayed. There are only two web pages, no matter how many Page Separator columns you added; one web page for page 1 (Newform.aspx) and one web page for all other "pages" (Editform.aspx). What this means is that you cannot add a different page level (or web part) customization on "page 3" than on "page 4".
- Trivia: Both SharePoint 2010 and 2013 surveys still use the old 2007 user interface! No ribbon!
When you respond to a multipage survey the following happens:
- NewForm.aspx is displayed. (this is the first "page" of your survey) When you click Next SharePoint creates a new list item in the Survey list and then loads EditPage.aspx for the rest of the questions. The URL for the first page looks like this:
(2007 and 2013 do not add the "?IsDlg=1".)
- EditForm.aspx is displayed for "page 2" starting with the next question in the survey. In my example the question is named "Comments":
(2007 and 2013 do not add the "?IsDlg=1". ID is the item ID of this survey response.)
- EditForm.aspx is displayed for "page 3" starting with the next question in the survey. In my example the question is named "How many days?":
Note that after page one the same web page (and web part) is used to display all remaining questions. They only difference is the FirstField parameter in the URL. So… an edit made to NewForm.aspx is displayed on the first page of the survey while an edit made to EditForm.aspx is displayed on all survey pages after page 1.
Here's the steps for SharePoint 2007, 2010 (or Office 365 2010) and 2013:
- Create the survey as usual
- Go to the survey and click "Respond to this Survey". (you will be on NewForm.aspx) If it is a multi page survey and you want to edit everything after page 1 then click Next. (You will be on EditForm.aspx)
- For SP 2010, right-click in a blank area in the dialog box and click Properties. Copy the URL (make sure you get it all as only two lines are displayed) Paste the URL into the browser's address bar. If you are working with 2010 then remove the "?IsDlg=1" from the URL. Press Enter to display the form.
- For 2007 add "&ToolPaneView=2" to the end of the URL Press Enter to display the form.
- For SP 2010 and 2013 click Site Actions (The "gear" for 2013) and Edit Page. (2007 is already in edit mode due to the ToolPaneView=2.)
- Click Add A Web Part and add your Content Editor Web Part. This is where SP 2013 fails. The panel to add a web part is displayed behind the web page. You can see it but not click it. Go to SharePoint Designer, open the site, open the survey list and edit NewForm.aspx or EditForm.aspx and add the web part there.
- Click the dropdown menu on the web part and click Edit Web Part. For SP 2007 click the Rich Text button. For SP 2010 click in the web part and start typing. For SP 2010 the text editor ribbon will not be displayed. You may want to create the text in another CEWP and copy and paste it into this CEWP.
- Click the OK in the web part's Properties panel to save your changes.
- Test your survey.
Tip: When you create your survey checkmark "Allow multiple responses". If you forgot to do this then go to the Survey and click Settings, Survey Settings, Title Description and Navigation.
- A list of survey tips, including how to create custom views
- A better Yes/No field for surveys and lists
- Adding a Welcome or Instructions message to the Overview page
- Adding a Welcome, Instructions or Thank You message to the survey
- Adding Color, Fonts and HTML to Surveys