Wednesday, December 16, 2009

Limiting the number of responses in survey

Hi All,

In this article, I am going to share one very important aspect of survey. Many times we require limiting number of responses from survey. However SharePoint does not provide us with the facility to limit the number of responses.

Ok, then how to achieve this? Here we go, follow these simple steps and you are good to go.

(1) Write one web part and write one code which checks for the total responses for specific survey. Add this web part on NewForm.aspx and overview.aspx, all responses and graphical summary of the survey. You get NewForm.aspx when you click on respond to the survey button.

(2) Write down simple code, check URL, if NewForm word exist, then just count the total number of item in survey and if it exceeds let’s say 30 responses, and then redirect back to Source parameter.

(3) If in URL overview, allitems or summary exist, just count the total number of item in survey and if it exceeds let’s say 30 responses then write a statement saying you are not allowed to respond because it has already reached to the maximum responses.

Your job is done.

2 comments:

hilman said...

hi,

this is exactly what i want to do . can u show us simple code for this to happen?

thanks.

SharePoint Kings said...

@hilman,

this is what we want our reader should do :)

you start and if you stuck we will help you.




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