Sandbox has many limitation affect building this module:
- Cannot run component with elevated privilege or impersonate user. (Poll Component for anonymous users)
- Sandbox cannot serialize cookie only can read a cookie.
For these reason cannot build solution using sandbox to build a poll. Only Customize predefined controls using SharePoint Designer to build a poll.
Steps:
- Create 2 Lists:
- Poll List with Fields Question(Text), Answer1(Text), Answer2(Text), Answer3(Text), Active(Yes/No)
- Poll Result QuestionId, Answer1Count(Number Default 0), Answer2Count(Number Default 0), Answer3Count(Number Default 0)
- Create Workflow When you add a Poll Item in List It will add item in Poll Result.
- Give Add Permission of anonymous user in Poll Result.
- Create Active Workflow to allow only one active poll. If We activated Poll, Deactivate others.
- Create DataView For Displaying a Poll:
- DataSource read the 2 lists read active poll and its results.
- XSLT contains 2 View:
1. Show Poll and allow user to vote. Appears if user didn't respond on this poll.
This contains form question as title and questions as radio buttons in Forms and button for respond.
When user click button. It will call client object model to increase selected answer count. and set cookie using JavaScript using jquery that he answer this question.
you can use captcha using javascript:
http://sharepointserver-2007.blogspot.com/2012/01/capatcha-using-javascript.html
2. Show Results display Poll Result. . Appears if user respond on this poll.
Validation that user respond this answer check if active poll Id exists in cookie that set in previous step. You can build graph for displaying results using div and style sheets.
This is simple Poll for sandbox or Office 365 you can add more enhancement.
No comments:
Post a Comment