Wrapping long questions in SharePoint surveys

Nothing like finding a solution to a problem for the end of the year. Don't say I didn't give you anything.

I was recently asked about how to tackle long questions in surveys with SharePoint, specifically there's a problem that long questions don't wrap so you get a really ugly looking website. Go ahead, create a survey and add a really long question to it. Notice how you're stuck with horizontal bars from hell? Here's how to get rid of it.

  1. Create your survey as you normally would.
  2. Select Respond to this Survey.
  3. Click on the Edit with Microsoft Office FrontPage on the IE toolbar. This will launch FrontPage with the NewForm.aspx page loaded.
  4. Right click on the Survey form in FrontPage and select Customize SharePoint List Form from the popup menu. This will convert the form to something you can edit. NOTE: It's not pretty as all the HTML tags are now literal so be careful editing these!
  5. Scroll down and find a tag that starts with something like this:
    <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">
    The rest of this tag will contain the HTML for your survey form (like I said all the HTML tags are literal so <TD> will look like &lt;TD&gt;)
  6. Find the tag that looks something like this TR&gt;&lt;TH nowrap valign=top class=&quot;ms-formlabel&quot;&gt;
  7. Change the TH nowrap to TH wrap
  8. Save the page and return to your browser.

You'll see the change in FP and when you refresh the page in your browser. The text now wraps and all is well. Neat huh? Repeat this for each question (keep looking for the ms-formlabel class). These instructions are only for the NewForm.aspx page which is what users will see when they respond to a survey. There are still other pages which suffer from the "nowrap" tag so you'll have to edit each of those. They are:

  • DispForm.aspx (used to view a single result)
  • EditForm.aspx (when you edit an existing response)
  • summary.aspx (when you want to see a graphical view of all responses)

AllItems.aspx and overview.aspx don't show the questions so you don't have to worry about this files.

Another way to do this is to open up the site, not the page, in FrontPage and expand the survey you want to edit using the Folder List (Alt+F1) from the View menu. From here you can just edit NewForm.aspx and the other pages directly and take out that nasty "nowrap" attribute.

Hope that helps and have a safe and happy New Year!

5 Comments

  • Though not as easy, this can also be done in the SCHEMA.XML file for the list definition on the server (in the &lt;Form&gt; elements). Doing it there has the benefit of having it automatically apply to all surveys created on the server without unghosting the pages.

  • This is very cool!! One problem, it can get time consuming if you have to change more than 100+ questions.

  • James,



    As Jim mentioned, if you do the change to the SCHEMA.XML file it will automagically apply to all surveys that are based on the site defintion.

  • This worked well for survey questions, but I didn't have the same luck with custom lists. Any reason why?

  • Thanks for this info. Just for newbies (like me) you can find the appropriate schema.xml file here:

    C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\SPS\LISTS\VOTING

    There are four lines that match what Bil tells you to look for. I found that searching for ms-formlabel and then looking to see if the line has TH nowrap worked for me.

    Also, I don't know if you have to change all four, but I like the brute force and ignorance method of changing code!

Comments have been disabled for this content.