Saturday, September 5, 2009

Creating and working with Survey in SharePoint - Part 4

Hi All,

Here I am going to discuss something interesting especially on overview.aspx of survey list. If you have not gone through the survey articles, I would recommend you to read them all first before you read further.

Creating and working with Survey in SharePoint - Part 1

Creating and working with Survey in SharePoint - Part 2

Creating and working with Survey in SharePoint - Part 3

and

Creating and working with Survey in SharePoint - Part 5


One question came in my mind. Why any responder of survey should care about knowing when survey was created and how many number of responses has come so far. If we have set the permission in advance settings of survey that user can only see their response, and then also responder can see how many responses have come so far.

If we do not want to allow any responder to see when survey was created and how many responses has come so far, then do one very easy thing. Just add one more content editor web part on the overview.aspx page of survey and copy and paste the below code and there you go, you have each and every option just like you have in normal survey web part on overview.aspx. The only difference is that here you cannot see number of responses and date created. Make sure that you hide the default web part on that page by modifying that web part and setting hidden to true under layout option. So simple…isn’t it.

Just make sure that you replace the {siteurl} for HREF in below code. Just place your site url there and you should be good to go.


<table class="ms-menutoolbar" cellpadding="2" cellspacing="0" border="0" id="ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl" width="100%" >
<tr> <td class="ms-toolbar" nowrap="true">
<div class="ms-buttoninactivehover" onmouseover="this.className='ms-buttonactivehover'" onmouseout="this.className='ms-buttoninactivehover'"><a id="ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RptControls_ctl00_diidIONewItem" accesskey="N" title="Respond to this Survey" onclick="javascript:NewItem('\u002fsites\u002fTest\u002fLists\u002fSharePoint\u002520site\u002520survey\u002fNewForm.aspx');return false;" href="javascript:__doPostBack('ctl00$m$g_c84f415c_dba8_4240_b34d_263e596c7eed$ctl00$ctl00$toolBarTbl$RptControls$ctl00$diidIONewItem','');"><img align='absmiddle' alt="Respond to this Survey" src="/_layouts/images/NewItem.gif" style='border-width:0px;'>&nbsp;Respond to this Survey</a></div>
</td>
<td class=ms-separator><img src='/_layouts/images/blank.gif' alt=''></td>
<td class="ms-toolbar" nowrap="true">


<span style="display:none"><menu type='ServerMenu' id="zz13_RptControls" largeIconMode="true"><ie:menuitem id="zz14_ExportToSpreadsheet" type="option" iconSrc="/_layouts/images/MenuSpreadsheet.gif" onMenuClick="javascript:EnsureSSImporter();javaScript:ExportList('\u002fsites\u002fTest\u002f_vti_bin\u002fowssvr.dll?CS=65001\u0026Using=_layouts\u002fquery.iqy\u0026List=\u00257BA1B0E302\u00252D497E\u00252D45B9\u00252D9994\u00252D9F0E0171A380\u00257D\u0026View=\u00257BC84F415C\u00252DDBA8\u00252D4240\u00252DB34D\u00252D263E596C7EED\u00257D\u0026RootFolder=\u00252Fsites\u00252FTest\u00252FLists\u00252FSharePoint\u002520site\u002520survey\u0026CacheControl=1')" text="Export to Spreadsheet" description="Analyze items with a spreadsheet application." menuGroupId="800"></ie:menuitem><ie:menuitem id="ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RptControls_ctl01_ctl00_ctl03" type="separator"></ie:menuitem><ie:menuitem id="zz15_ViewRSS" type="option" iconSrc="/_layouts/images/MenuRSS.gif" onMenuClick="window.location = '/sites/Test/_layouts/listfeed.aspx?List=%7BA1B0E302%2D497E%2D45B9%2D9994%2D9F0E0171A380%7D';" text="View RSS Feed" description="Syndicate items with an RSS reader." menuGroupId="800"></ie:menuitem><ie:menuitem id="zz16_SubscribeButton" type="option" iconSrc="/_layouts/images/MenuAlert.gif" onMenuClick="window.location = '/sites/Test/_layouts/SubNew.aspx?List=%7BA1B0E302%2D497E%2D45B9%2D9994%2D9F0E0171A380%7D&amp;Source=http%3A%2F%2Fsharepointkings%3A7777%2Fsites%2FTest%2FLists%2FSharePoint%2520site%2520survey%2Foverview%2Easpx';" text="Alert Me" description="Receive e-mail notifications when items change." menuGroupId="800"></ie:menuitem></menu></span><span title="Open Menu"><div id="zz17_ListActionsMenu_t" class="ms-menubuttoninactivehover" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoverActive="ms-menubuttonactivehover" hoverInactive="ms-menubuttoninactivehover" onclick=" MMU_Open(byid('zz13_RptControls'), MMU_GetMenuFromClientId('zz17_ListActionsMenu'),event,false, null, 0);" foa="MMU_GetMenuFromClientId('zz17_ListActionsMenu')" oncontextmenu="this.click(); return false;" nowrap="nowrap"><a id="zz17_ListActionsMenu" accesskey="C" href="#" onclick="javascript:return false;" style="cursor:hand;white-space:nowrap;" onfocus="MMU_EcbLinkOnFocusBlur(byid('zz13_RptControls'), this, true);" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz13_RptControls'), MMU_GetMenuFromClientId('zz17_ListActionsMenu'), event);" onclick=" MMU_Open(byid('zz13_RptControls'), MMU_GetMenuFromClientId('zz17_ListActionsMenu'),event,false, null, 0);" oncontextmenu="this.click(); return false;" menuTokenValues="MENUCLIENTID=zz17_ListActionsMenu,TEMPLATECLIENTID=zz13_RptControls" serverclientid="zz17_ListActionsMenu">Actions<img src="/_layouts/images/blank.gif" border="0" alt="Use SHIFT+ENTER to open the menu (new window)."/></a><img align="absbottom" src="/_layouts/images/menudark.gif" alt="" /></div></span>
</td>
<td class=ms-separator><img src='/_layouts/images/blank.gif' alt=''></td>
<td class="ms-toolbar" nowrap="true">


<span style="display:none"><menu type='ServerMenu' id="zz18_RptControls" largeIconMode="true"><ie:menuitem id="zz19_AddQuestions" type="option" onMenuClick="window.location = '/sites/Test/_layouts/qstNew.aspx?List=%7BA1B0E302%2D497E%2D45B9%2D9994%2D9F0E0171A380%7D&amp;Source=http%3A%2F%2Fsharepointkings%3A7777%2Fsites%2FTest%2FLists%2FSharePoint%2520site%2520survey%2Foverview%2Easpx';" text="Add Questions" description="Add an additional question to this survey." menuGroupId="100"></ie:menuitem><ie:menuitem id="zz20_ListSettings" type="option" iconSrc="/_layouts/images/MenuListSettings.gif" onMenuClick="window.location = '/sites/Test/_layouts/survedit.aspx?List=%7BA1B0E302%2D497E%2D45B9%2D9994%2D9F0E0171A380%7D';" text="Survey Settings" description="Manage questions and settings for this survey." menuGroupId="200"></ie:menuitem></menu></span><span title="Open Menu"><div id="zz21_ListSettingsMenu_t" class="ms-menubuttoninactivehover" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoverActive="ms-menubuttonactivehover" hoverInactive="ms-menubuttoninactivehover" onclick=" MMU_Open(byid('zz18_RptControls'), MMU_GetMenuFromClientId('zz21_ListSettingsMenu'),event,false, null, 0);" foa="MMU_GetMenuFromClientId('zz21_ListSettingsMenu')" oncontextmenu="this.click(); return false;" nowrap="nowrap"><a id="zz21_ListSettingsMenu" accesskey="I" href="#" onclick="javascript:return false;" style="cursor:hand;white-space:nowrap;" onfocus="MMU_EcbLinkOnFocusBlur(byid('zz18_RptControls'), this, true);" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz18_RptControls'), MMU_GetMenuFromClientId('zz21_ListSettingsMenu'), event);" onclick=" MMU_Open(byid('zz18_RptControls'), MMU_GetMenuFromClientId('zz21_ListSettingsMenu'),event,false, null, 0);" oncontextmenu="this.click(); return false;" menuTokenValues="MENUCLIENTID=zz21_ListSettingsMenu,TEMPLATECLIENTID=zz18_RptControls" serverclientid="zz21_ListSettingsMenu">Settings<img src="/_layouts/images/blank.gif" border="0" alt="Use SHIFT+ENTER to open the menu (new window)."/></a><img align="absbottom" src="/_layouts/images/menudark.gif" alt="" /></div></span>
</td>

<td width="99%" class="ms-toolbar" nowrap><IMG SRC="/_layouts/images/blank.gif" width=1 height=18 alt=""></td>


<td class="ms-toolbar" nowrap="true">

<table border=0 cellpadding=0 cellspacing=0 style='margin-right: 4px'>
<tr>
<td nowrap class="ms-toolbar" id="topPagingCellWPQ2">
<td>
</tr>
</table>

</td>
<td class=ms-separator> </td>
<td class="ms-toolbar" nowrap="true">

<table border=0 cellpadding=0 cellspacing=0 style='margin-right: 4px'>
<tr>
<td nowrap class="ms-listheaderlabel">View:&nbsp;</td>
<td id="ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RightRptControls_ctl01_ctl00_onetViewSelector" nowrap="nowrap" class="ms-viewselector" onmouseover="this.className='ms-viewselectorhover'" onmouseout="this.className='ms-viewselector'">
<span style="display:none"><menu type='ServerMenu' id="zz22_ViewSelectorMenu" CompactMode="true"><ie:menuitem id="zz23_DefaultView" type="option" onMenuClick="window.location = '/sites/Test/Lists/SharePoint site survey/overview.aspx';" text="Overview" menuGroupId="100"></ie:menuitem><ie:menuitem id="zz24_View1" type="option" onMenuClick="window.location = '/sites/Test/Lists/SharePoint site survey/AllItems.aspx';" text="All Responses" menuGroupId="300"></ie:menuitem><ie:menuitem id="zz25_View2" type="option" onMenuClick="window.location = '/sites/Test/Lists/SharePoint site survey/summary.aspx';" text="Graphical Summary" menuGroupId="300"></ie:menuitem></menu></span><span title="Open Menu"><div id="zz26_ViewSelectorMenu_t" class="ms-viewselector" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoverActive="ms-viewselectorhover" hoverInactive="ms-viewselector" onclick=" MMU_Open(byid('zz22_ViewSelectorMenu'), MMU_GetMenuFromClientId('zz26_ViewSelectorMenu'),event,true, 'ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RightRptControls_ctl01_ctl00_onetViewSelector', 0);" foa="MMU_GetMenuFromClientId('zz26_ViewSelectorMenu')" oncontextmenu="this.click(); return false;" nowrap="nowrap"><a id="zz26_ViewSelectorMenu" accesskey="W" href="#" onclick="javascript:return false;" style="cursor:hand;white-space:nowrap;" onfocus="MMU_EcbLinkOnFocusBlur(byid('zz22_ViewSelectorMenu'), this, true);" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz22_ViewSelectorMenu'), MMU_GetMenuFromClientId('zz26_ViewSelectorMenu'), event);" onclick=" MMU_Open(byid('zz22_ViewSelectorMenu'), MMU_GetMenuFromClientId('zz26_ViewSelectorMenu'),event,true, 'ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RightRptControls_ctl01_ctl00_onetViewSelector', 0);" oncontextmenu="this.click(); return false;" menuTokenValues="MENUCLIENTID=zz26_ViewSelectorMenu,TEMPLATECLIENTID=zz22_ViewSelectorMenu" serverclientid="zz26_ViewSelectorMenu">Overview<img src="/_layouts/images/blank.gif" border="0" alt="Use SHIFT+ENTER to open the menu (new window)."/></a><img align="absbottom" src="/_layouts/images/blank.gif" alt="" /></div></span>
</td>

</tr>
</table>

</td>

</tr>
</table>


<TABLE class="ms-summarystandardbody" cellpadding=0 cellspacing=0 width=600px style="margin: 10px;" border=0 rules=rows> <TR> <TD class="ms-formlabel" width=190px ID="overview01">Survey Name:</TD> <TD class="ms-formbody" >Movie knowledge survey</TD> </TR> <TR> <TD class="ms-formlabel" valign="top" ID="overview02">Survey Description:</TD> <TD class="ms-formbody">This is the startbold Hindi endbold as well as the startitalic English movie enditalic Knowledge survey. linebreak

we would like to know how much people are startunderline aware about the Hindi and English movies endunderline</TD> </TR> <TR> <TD><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></TD> </TR> </TABLE>
<TABLE border=0 style="margin: 0px 8px 0px 8px;">
<tr><td><img src="/_layouts/images/blank.gif" width=1 height=4 alt=""></td></tr>
<tr>
<td nowrap>
<img src="/_layouts/images/rect.gif" alt=""><span class=ms-toolbar>&nbsp;</span>
<a class="ms-toolbar" ACCESSKEY=R ID=diidSurveyResults HREF="{siteurl}/Lists/SharePoint site survey/summary.aspx"><!-- _locID_text="overview05" _locComment="{StringCategory=TXT}"-->Show a graphical summary of responses</a>
<span class=ms-toolbar>&nbsp;</span>
</td>
</tr>
<tr>
<td nowrap>
<img src="/_layouts/images/rect.gif" alt=""><span class=ms-toolbar>&nbsp;</span>
<a class="ms-toolbar" ACCESSKEY=U ID=diidResultsByUser HREF="{siteurl}Lists/SharePoint site survey/AllItems.aspx"><!-- _locID_text="overview06" _locComment="{StringCategory=TXT}"-->Show all responses</a>
<span class=ms-toolbar>&nbsp;</span>
</td>
</tr>
</TABLE>


And see the effect of the above code.




That's it.

9 comments:

Anonymous said...

Hi ,
As for chapter 4 I have tried to use &ToolPaneView=2 with overview.aspx to add the Webpart, but unfortunately gettinh HTTP 400 file not found.
The other pages work ok. is there security setting?
Could you please help with that.
Thanx a lot,
Jon.

SharePoint Kings said...

Jon,

check this link http://www.sharepointkings.com/2008/05/how-to-edit-list-forms-like-newformaspx.html

Anonymous said...

hi kings..

I am working with surveys

when i create a survey how can i intimate my users to respond to a survey..
i tried to use workflow to send mails but its not working..

SharePoint Kings said...

@Anonymous,

survey is just like a list and its question and answer is like list items

and by sharepoint default behavior, you can put alert on list item not on list. even workflow can attach to list after creation of list.

so no chance by default you can do that.

one thing you can try
use List adding or added event, find list type, and do something.

Anonymous said...

About the posted code: There are many "Test" not valid paths in the code it's not working.
About the method on Alexander's blog:
After copy/paste the code You loose access to "edit" menue on the previous survay and also the links got confused Instead taking me to the surway I went to the survay "settings" page.
Not working, but the idea is OK.

Anonymous said...

use ?&ToolPaneView=2

Anonymous said...

Is the code displayed the actual page or the CEWP script code? Seems so much different from the survey articles 1, 2, 3, & 5. Doesn't look like the code ould be re-useable from a central location, which would be the better solution. Am I wrong? or need more info to better understand this solution? Thanks, Paul

SharePoint Kings said...

@Paul,

this is the script inside CEWP.

yes you are correct that it cannot be used from central location because its not made for it.

all the article having different tips to change different thing.
it helps if you want to use only one functionality. if you use all then you can add all script in one CEWP (just check variables and sequence it may be override few functionality)

another reason you feel, its not all in one solution is because SharePoint is not provide proper resolution of survey customization

we are modifying rendered HTML of SharePoint which contains some risk and visible at client side and can be decoded.

but the article showing over here are quick resolution of general problem that we received from our readers.

Deepa Sharma said...

Thanks a lot works well for me




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com