Q 我吧
今日看到ted tend 的关于SharePoint 方面的文章,就贴出来做个记录,作为自己的备忘。
How to Create Multiple Sections/Pages Survey
Submitted By: ted tend

Description:
In the real world, surveys are quite long and consist of several logic sections. The traditional online survey always splits the long survey into several web pages to make responders easily focus their attention on the survey. However, in SharePoint world, the survey always presents the questions on one page. Such a long page is not very user-friendly.

So this tip will discuss some work-around to deploy a long survey into multiple pages that users used to. The key trick is to create several SharePoint surveys per survey section and then change the newform.aspx interface, add a "Go to next section" button to lead responders go to next section's newform.aspx. On the last section's survey, add a submit button to direct users to a Thanks web page.

Assume there are two sections in survey, Part I - Personal Info and Part II - Service Satisfaction.

  1. Go to a Sharepoint website
  2. Create two surveys named "Personal Info" and "Service Satisfaction" and input the respective questions in each survey
  3. Open this site using FP2003 Open \Lists\Personal Info\newform.aspx
  4. Remove the original top toolbar(such as "Save and Close | go back to Survey") by inserting below codes before < /body > tag

< script>
    document.getElementById("toolBarTbl").innerText="";
</ script>

  1. Insert a "go to next section" button after < /WebPartPages:WebPartZone> like this: < input type=submit value="Go to next section" onclick="ClickOnce()" class="ms-toolbar" >
  2. Overwrite the ClickOnce() function and also insert the below code before the tag of < /Body> This function will save and close the current survey window and open a new window directing to the next section survey newform.aspx

< script>
 
f unction ClickOnce()
{
SetAction();
if(!g_MSclicked)
{
if(frm.ValidateAndSubmit(true))
g_MSclicked = true;
}
else
{
if(confirm(L_ClickOnce1_text ))
frm.ValidateAndSubmit(true);
}

FP_openNewWindow('800', '600', true, true, true, true, true, true, 'newForm', "next section survey url");
//open next section survey and close the current survey
//pls replace the last string with ur next survey newform.aspx like http://.../Lists/Service Satifsfaction/newform.aspx
}

f unction FP_openNewWindow(w,h,nav,loc,sts,menu,scroll,resize,name,url) {//v1.0
var windowProperties=''; if(nav==false) windowProperties+='toolbar=no,'; else
windowProperties+='toolbar=yes,'; if(loc==false) windowProperties+='location=no,';
else windowProperties+='location=yes,'; if(sts==false) windowProperties+='status=no,';
else windowProperties+='status=yes,'; if(menu==false) windowProperties+='menubar=no,';
else windowProperties+='menubar=yes,'; if(scroll==false) windowProperties+='scrollbars=no,';
else windowProperties+='scrollbars=yes,'; if(resize==false) windowProperties+='resizable=no,';
else windowProperties+='resizable=yes,'; if(w!="") windowProperties+='width='+w+',';
if(h!="") windowProperties+='height='+h; if(windowProperties!="") {
if( windowProperties.charAt(windowProperties.length-1)==',')
windowProperties=windowProperties.substring(0,windowProperties.length-1); }
window.open(url,name,windowProperties);
window.close();
}

< /script >

  1. If you have more sections before the last, you can repeat the Step 3- Step 6 and remember to change the next survey url value in Step 6
  2. Create a Thanks web part page (Create --> Web part Page --> insert a Content Web Part --> add some Thanks message->
  3. Open the last section survey newform.aspx page, in this case, ...\Lists\Service Satisfaction\newform.aspx
  4. Repeat the Step 4-6, but change the Submit button value as "Submit" Repeat the Step 5, change the url value as the Thanks page url in Step 6
  5. So now a multiple pages survey is completed. When you deploy the survey, you need to provide the users the url of the first section newform.aspx and then the users can complete the surveys section by section (page by page).

The LIMITATION of this work-around

  • The Summary of this survey will be separated in different survey lists
  • Users will not get the default Edit/Delete function
posted on 2005-03-02 09:19  BlackAngel2bAssassin  阅读(716)  评论(0编辑  收藏  举报